Live data from Hacker News

Why the iPhone Timer app displays a fake time

lukashermann.dev

11–20 of 83 posts

Re: Why the iPhone Timer app displays a fake time

#11
post #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.)

The sentence quoted is for the first example in the post, not the iPhone timer.

That’s most likely what it does indeed, much more elegant than keeping track of the extra 500ms.

Re: Why the iPhone Timer app displays a fake time

#12
I think my Garmin smartwatch shows distance rounded up, but plays alerts based on the actual value. So you can have run a watch that says you've run 10.00 km on the display... but have to go a bit further to trigger the 10 km vibration alarm. And crucially if you stopped before the alarm it wouldn't register as a 10 km for your records!

Re: Why the iPhone Timer app displays a fake time

#13
I built a similar tool to the OP that implements the same rounding behavior if you’re in the iOS ecosystem — https://apps.apple.com/us/app/synctimer-by-practice/id152297...

One of the main benefits is that it doesn’t require the internet and can synchronize iPhones, iPads, and Apple TV’s using either peer-to-peer WiFi or Bluetooth with no manual pairing.

Also had an interval timer for exercises, group activities, etc...

Re: Why the iPhone Timer app displays a fake time

#14
I think I find the ceiling method most intuitive. I have noticed that video games with cooldowns tend to agree with me; some ability has a 4 second cooldown, you press it, and the UI says "4", even though 3.999 seconds remain until the ability is back. (This means that you never see "0"; the counter reads "1" for the last second before the cooldown is available again.)

Re: Why the iPhone Timer app displays a fake time

#15
post #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.)

Agreed, to my eyes it seems clear that the display shows both “5” and “0” for half a second, which means the total duration is still 5 seconds, not 5.5 seconds.

Re: Why the iPhone Timer app displays a fake time

#16
post #11
post #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.)

The sentence quoted is for the first example in the post, not the iPhone timer. That’s most likely what it does indeed, much more elegant than keeping track of the extra 500ms.

I realize that. It seems like the entire blog post could be summarized as "I thought about doing something this way and when it didn't give me what I and everyone else expects out of a timer, my mental model adjusted to conclude that Apple was doing some weird gymnastics involving adding 500ms to some of their timer code and using Math.floor() but not to the time the timer actually goes off rather than adjusting my mental model to match the simpler way that humans expect rounding to work in a timer using [the equivalent of] Math.round()."

Re: Why the iPhone Timer app displays a fake time

#19
This gives me a nostalgic reminder of when I used to watch Nickelodeon GUTS. Whenever a countdown timed challenge was about to end, I would hear the audience count down starting with "10" at maybe 10.7 seconds, "9" at 9.7 seconds, etc. Then after "1", there was a small period of awkward silence and murmurs from the audience before the siren blasted.

It's a good example of how measurement of time in terms of human perception differs from the pure mathematical sense, and rounding is a good compromise here (wherever it doesn't display fractional seconds).

Post reply on HN