Error in Minutes when Minutes 60
Opened this issue · 0 comments
aqkhana2002 commented
func floatToHourMinute(_ time:Double)->(hours:Int, minutes:Int)? {
if time.isNaN {
return nil
}
let ttime = fixHour(time + 0.5 / 60.0) // add 0.5 minutes to round
var hours = Int(floor(time))
var minutes = Int(floor((ttime - Double(hours)) * 60.0))
return (hours: hours, minutes: minutes)
}
Change to :
`
func floatToHourMinute(_ time:Double)->(hours:Int, minutes:Int)? {
if time.isNaN {
return nil
}
let ttime = fixHour(time + 0.5 / 60.0) // add 0.5 minutes to round
var hours = Int(floor(time))
var minutes = Int(floor((ttime - Double(hours)) * 60.0))
if (minutes>=60)
{
hours = hours + 1
minutes=0
}
return (hours: hours, minutes: minutes)
}
`