Why the iPhone Timer app displays a fake time
lukashermann.dev
Why the iPhone Timer app displays a fake time
1–10 of 83 posts
Re: Why the iPhone Timer app displays a fake time
#2From what I can see, the iPhone timer app is rounding to the nearest second. For positive numbers that can be accomplished with either Math.round(t) or Math.floor(t+0.5).
Re: Why the iPhone Timer app displays a fake time
#3Answer: it rounds to the nearest second.
Re: Why the iPhone Timer app displays a fake time
#4... or they just round the time to the nearest second instead of taking the floor
Re: Why the iPhone Timer app displays a fake time
#5I think "rounds to closest" is a simpler way to put it than "adds 500 ms before truncating".
Re: Why the iPhone Timer app displays a fake time
#6> Milliseconds are converted to seconds by dividing by 1000 and rounding down like so
It seems like the simpler explanation is that the iPhone actually rounds to the closest integer rather than rounding down. (Whether they do this invisibly by adding 0.5s and rounding down is an implementation detail.)
Re: Why the iPhone Timer app displays a fake time
#7iOS 9 and below, IIRC, the timer app stopwatch screen would really flake out after 1000 hours. By 'flake out' I mean it would slow down the updating a lot - screen got somewhat jerky and slow to respond.
From iOS 10 onwards, 1000+ hours doesn't seem to phase it at all - no slow downs.
source: 1490:43:24 ago I started my timer, but I can't remember why now.
Re: Why the iPhone Timer app displays a fake time
#8While building a tea timer I naturally stumbled into this exact solution.
Edit: sencha.app for those curious
Re: Why the iPhone Timer app displays a fake time
#9[deleted]
Re: Why the iPhone Timer app displays a fake time
#10Round half up is the typical expectation for most people in rounding to the nearest whole value.
It isn't displaying a "fake" time, it's rounding.
https://en.wikipedia.org/wiki/Rounding#Round_half_up
Edit: Note, Round Half Up != Round half away from zero but that isn't important for this scenario :D