News for hackers. Stuff that matters.
Re:Why the iPhone Timer app displays a fake time by magicalhippo on Monday December 28, 2020 @08:27PM (#25565571)
> However, this would result in 59.51s being displayed as 0:60, though it should be 1:00. Rounding up has the same problem.

Surely one shouldn't round _after_ splitting the time into minutes and seconds.

You floor() or ceil() the time, depending on if you're counting up or down, to the lowest unit your timer is showing, then you display it and in the process split it into hours, minutes etc.

So ceil(59.51s) = 60s, which is then converted to 0h 1m 0s for display.

There are no comments on this comment yet.