[HN Gopher] Why the iPhone Timer App displays a Fake Time
       ___________________________________________________________________
        
       Why the iPhone Timer App displays a Fake Time
        
       Author : _antix
       Score  : 58 points
       Date   : 2020-12-28 21:56 UTC (1 hours ago)
        
 (HTM) web link (lukashermann.dev)
 (TXT) w3m dump (lukashermann.dev)
        
       | jewel wrote:
       | From 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).
        
       | jrockway wrote:
       | 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.)
        
       | tantalor wrote:
       | Answer: it rounds to the nearest second.
        
       | tobr wrote:
       | > But for a countdown timer, this is counterintuitive.
       | 
       | I get the feeling this pun wasn't intentional, but it's a good
       | one nonetheless.
        
       | dan-robertson wrote:
       | ... or they just round the time to the nearest second instead of
       | taking the floor
        
       | nemetroid wrote:
       | I think "rounds to closest" is a simpler way to put it than "adds
       | 500 ms before truncating".
        
       | sokoloff wrote:
       | > 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.)
        
         | tobr wrote:
         | 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.
        
         | jiofih wrote:
         | 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.
        
           | sokoloff wrote:
           | 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()."
        
       | stevage wrote:
       | Very weird to frame this as "lying" and "fake" when it's just
       | using .round() instead of .floor()
        
       | mgkimsal wrote:
       | iOS 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.
        
       | arthurofbabylon wrote:
       | While building a tea timer I naturally stumbled into this exact
       | solution.
       | 
       | Edit: sencha.app for those curious
        
       | [deleted]
        
       | kivlad wrote:
       | 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).
        
       | mey wrote:
       | Round 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
        
       | chrisseaton wrote:
       | 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!
        
       | vthommeret wrote:
       | 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...
        
       ___________________________________________________________________
       (page generated 2020-12-28 23:00 UTC)