11 ms·
Why the iPhone Timer app displays a fake time
- jewel 6y agoFrom 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).
- tantalor 6y agoAnswer: it rounds to the nearest second.
- dan-robertson 6y ago... or they just round the time to the nearest second instead of taking the floor
- nemetroid 6y agoI think "rounds to closest" is a simpler way to put it than "adds 500 ms before truncating".
- sokoloff 6y ago> 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.)
- jiofih 6y agoThe 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 6y agoI 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()."
- deleted 6y ago[deleted]
- tobr 6y agoAgreed, 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.
- throwaway2245 6y agoCorrectly rounding to the nearest second is exactly the behaviour that I expect from a timer. It's not "fake".
- londons_explore 6y agoUnless you pause it... In which case it rounds up...
- furyofantares 6y agoOnly at 0:00. That's a separate feature, showing 0:01 at a minimum for a paused timer (presumably to make it very clear that you aren't looking at an expired timer, even though the UI disappears for an expired timer.)
- throwaway2245 6y agoAh. I see that my Apple app does do that, but it's not my preference. I would much prefer "0 seconds remaining" to mean 0 to 0.5 seconds remaining, than any other possible case. I would find it much easier to parse. (Alternatively, please show more accuracy for this case, where it's likely relevant)
- deleted 6y ago[deleted]
- buzzerbetrayed 6y agoExactly. Seems like the author is suggesting a timer with 4.9 seconds left should tell you it has 4 seconds left instead of 5. Not sure why anyone would think this. The tidbit about it displaying 1 even if there is 0.01 left is interesting though. Makes sense.
- asddubs 6y agoreddit works like this if you get downvoted and only get to post every 10 minutes. it tells you you have to wait 1 more minute, and then a minute later it tells you you have to wait 59 more seconds, very counterintuitive. gets me every time when I have a post typed out and it's putting me on timeout for going against the grain (like e.g. suggesting that mob justice is bad)
- mgkimsal 6y agoiOS 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 6y agoWhile building a tea timer I naturally stumbled into this exact solution. Edit: sencha.app for those curious
- shinycode 6y agoThat was the solution as well for my primetimer app, funny that I had the same findings
- deleted 6y ago[deleted]
- mey 6y agoRound 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 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
- notatoad 6y agoRound half up is a reasonable thing to do with many data types, but it's not something that's typically done with time. Any sensible time handling solution will truncate instead of rounding. Which is not to call apple's timer nonsensical. I agree with the author that it's a nicer experience, but I think it's likely an intentional decision to make the display look better, not a consequence of naive rounding.
- dingaling 6y ago> Any sensible time handling solution will truncate instead of rounding. That doesn't really work for a countdown timer though since the last second would then display as zero, which is nonsense for 'time remaining'. You have to round up, always. The Android 9 countdown works intuitively, it takes a second to decrement from 5 to 4 and sounds the alarm exactly at 0. You can't pause it at zero... > Which is not to call apple's timer nonsensical. It pretty much is, since the last 'second' takes more than a second to elapse.
- function_seven 6y agoI'll rewrite parent's statement to apply to timers and stopwatches: > Any sensible time handling solution will round off toward the starting value. So a stopwatch won't display "1" until a full second has elapsed, and will look like this for five seconds: "0...1...2...3...4...5!" A timer won't display "4" until a full second has elapsed, and will look like this: "5...4...3...2...1...0!" In the stopwatch case, the display shows "0" for 0.999 s; in the timer case it'll show "1" for 0.999 s.
- chrisseaton 6y agoI 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 6y agoI 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/id1522971001 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...
- jrockway 6y agoI 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.)
- shirakawasuna 6y agoThe ceiling method matches with the expectation of how much time is left when the major digit changes, which is the same as how we do countdowns verbally in English. We say, "5, 4, 3, 2, 1, 0", not "4, 3, 2, 1, 0, done".
- tobr 6y ago> But for a countdown timer, this is counterintuitive. I get the feeling this pun wasn’t intentional, but it’s a good one nonetheless.
- stevage 6y agoVery weird to frame this as "lying" and "fake" when it's just using .round() instead of .floor()
- pram 6y agoTo be fair, it would be an extremely boring thing to write about without all the misleading hyperbole.
- kivlad 6y agoThis 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).
- monkpit 6y agoI was thinking of the same phenomenon, but at school sporting events when the crowd would count down while watching the time on the scoreboard. The awkward pause between shouts of “zero!” and the actual buzzer.
- rfraile 6y agoWhit these issues I always remember the unix “uptime” command and their rounded precision.
- wildmanx 6y agoMaybe the author should look up different modes of rounding. Round-to-nearest is what's the "intuitive" choice Apple made here. It's not "fake time". Srsly.. Besides, instead of truncating, it would even be sensible to do a round-up here, so that you get "5, 4, 3, 2, 1, done!" Non-mathematicians and non-programmers don't want to stare at 0 for a seconds. They likely don't want to stare at a 0 at all. That wouldn't "fake time" either. It really gets to me that he writes such an article and his self-description is "I'm a Maker and Full Stack Developer who loves working with the Frontend, Vue.js and User Interface Design." Not a great ad for yourself..
- kristo 6y agoYo. Stop being mean. This isn’t a competition. You’re not in high school anymore. You don’t need to put others down to boost yourself.
- bavell 6y agoMature adults should be able to take criticism without getting butt-hurt about it. The real world can be mean and nasty and sometimes you need a wake-up call that you're being silly or screwing up.
- 6y ago
- userbinator 6y agoNot a "fake time" at all, as many others here have already pointed out; but just an example of https://en.wikipedia.org/wiki/Quantization_error https://en.wikipedia.org/wiki/Quantization_error .
- punnerud 6y agoSummary: If you start a timer for 60 seconds it should practically not display 60, but should start at 59,... This is not intuitive so Apple added 500ms to the visualization.
- RivieraKid 6y agoThis blog could be summarized to fit into a tweet without losing any value.
- j1elo 6y agoThe way I see it, the problem stated by TFA is simply a mismatch between what wants to be represented vs. what is represented. Dividing the amount of milliseconds left / 1000 is too naive. If you want that the representation "0 seconds" actually matches the instant when there are actually 0 seconds left (i.e., no more time left), you should label these millisecond ranges as follows: * 5000 to 4001: "5 seconds" * 4000 to 3001: "4 seconds" * 3000 to 2001: "3 seconds" * 2000 to 1001: "2 seconds" * 1000 to 0001: "1 second" * 0: "0 seconds" (which usually the user doesn't read if the screen shows something else) Simple enough? The thing is, yes the iPhone timer does something in between, in order to show both the initial (5) and the final (0) numbers for a non-instantaneous amount of time, but (IMHO) that's the most confusing choice.
- lokar 6y agoEveryone is saying "rounding, duh" but that a bit unfair IMO You should show each integer value second for, ideally, one second (in the case with no display for fractional seconds). So the question is: exactly what rage of time to cover? The poster expected that for second N, it would be: [N,N+1) But Apple seems to do: [N-0.5, N+0.5) I think the Apple behavior makes perfect sense when you are displaying the current time (eg like a watch). It may be a little less obviously correct for the timer case, but still seems fine. I'd bet they implemented it for the time of day case and just re-used it for the timer case.
- benzoate 6y agoWell you have 6 numbers and only 5 seconds to show them in. You could show 0 only when the timer has fully completed. I think either rounding up, or rounding to the closest integer is fine. The authors expectation of always rounding down is the only option I would never expect.
- lokar 6y agoI think people have different expectations for: "What time is it now?" vs "How much time is left?"
- deleted 6y ago[deleted]
- 0003 6y agoIs this the fencepost problem but with time :P?
- renewiltord 6y agoAndroid shows rounded up. You never see zero. That also seems reasonable to me.
- cafeoh 6y agoI've never seen something so confusing. I've been (and quite frankly still am) seriously considering this is a big prank that's going over my head. The author even mentions that because time goes up and countdowns go down, rounding down is confusing. Wouldn't the logical conclusion be that you needed to round up? Wouldn't rounding up be the most logical option ANYWAY? If someone counts me down, I expect them to say "5, 4, 3, 2, 1, GO", and I expect a timer to do the exact same thing. This fixes seemingly every issue, starting on 5, not having to round to nearest integer (or add 500ms, which is an odd way to look at it, but sure), and not showing 0 (which I'd find quite weird). I just checked my own (Android) timer, and sure enough it rounds up, which is what I expected and what I expect from a countdown in general. Maybe what seems to me like the most obvious behaviour for a timer is not as obvious as I think, but why did the author not even mention rounding up as a solution, or how it could conflict with his own expectations? I'll just assume this to be a shower thought that didn't fully mature before making it into an article, but there seems to be enough effort that I'm still left quite confused. Oh and don't mistake this for a euphemism for me critiquing the intelligence of the author, at worst it's just a funny blindspot (as we all experience) but I'm seeing very little mentions in the comments here, which only adds to my bafflement.
- deleted 6y ago[deleted]
- deleted 6y ago[deleted]
- _antix 6y agoOriginal author here. I have thought about your and other peoples comments. It could well be just rounded to the nearest integer, making my +500ms assumption wrong. However, this would result in 59.51s being displayed as 0:60, though it should be 1:00. Rounding up has the same problem. I went through the same assumptions coding my own timer. Let's just round everything. But this resulted in 51.0s being displayed as 1:51 on the timer, with rounding up it's even worse resulting in 1:01:51. So at least hours and minutes have to be rounded down. But that makes it even more confusing that seconds are NOT Math.floor(). So in the end I "gave up" and used the date-fns package (works great) but it also rounds everything down. That's why I believe that iOS adds 500ms so the minutes and hours work properly.
- szhu 6y agoI feel like the countdown timer should round up, rather than round to the nearest integer. This makes it consistent with an integer stopwatch, which will round down. In my experience, Apple's timer behavior makes me feel like there's a weird half-second delay when starting and stopping the timer.
- jVinc 6y agoSeems like a bit of a reverse Occam's razor to explain that when the timer is at 0.501 it shows 1 and when its 0.499 it shows 0, is due to a fake secondary timer running with a 500ms offset that is rounded down, instead of just saying "the display is rounded to the nearest whole number".
- gfxgirl 6y agoI'm I alone in thinking the new timer app UI sucks? The old app where it used a spinner to set an alerm time and where I had N alarms that I could edit was simple and easy to use. The new app where hour and minutes are separate text fields and where you can't edit an alarm you can only delete old ones and create new ones is utterly unintuitive to me and much slower and more error prone than the old one. Clicking in the hour or minute section is a much smaller target. Editing sucks. I want to set an alarm for 10:00 and it defaults to showing the current time 09:33 so I click the 09 and type 1000 but it only edits the 09 to 10. The 33 stays and I have to click the other side and enter 00. To be snarky it's like some UX designer from Google went to Apple. This is not a UX I'd expect from Apple.
- withinboredom 6y agoI just ask Siri to "set an alarm for...", much less painful.
- gfxgirl 6y agoAsking siri is noisy, (people sleeping next to me).
- withinboredom 6y agoYou can type to Siri, under the accessibility settings.
- gfxgirl 6y agoTyping "Hey Siri, set an alarm for 10am" doesn't sound remotely like an improvement over the old alarm UX.
- withinboredom 6y agoIt's an improvement over the new one. IMHO anyway :)
- 6y ago
- beardyw 6y agoOther than the start and zero the time remaining is in reality an irrational number which cannot be represented at all. So every representation ever is truncated. :)