Live data from Hacker News

Why the iPhone Timer app displays a fake time

lukashermann.dev

31–40 of 83 posts

Re: Why the iPhone Timer app displays a fake time

#31

Earlier quoted context omitted.

> 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…

I'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 dis…

But this highlights the difference between the two devices, stopwatches and timers.

A stopwatch counts up. Therefore, it makes sense to use the floor (4.99 is still "4", not yet "5").

A timer counts down. Therefore, it makes sense to use the ceiling (3.01 is still "4", not yet "3").

In fact this was a turning point in the original article: "rounding down . . . makes a lot of sense when counting up. . . . But for a countdown timer, this is counterintuitive."

Re: Why the iPhone Timer app displays a fake time

#33

Earlier quoted context omitted.

I'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 dis…

But this highlights the difference between the two devices, stopwatches and timers. A stopwatch counts up. Therefore, it makes sense to use the floor (4.99 is still "4", not yet "5"). A timer counts down. Therefore, it makes sense to use the ceiling (3.01 is still "4", not yet "3"). In fact this was a turning point in the original article: "rounding down . . . makes a lot of sense when counting up. . . . But for a co…

Yup, that was my motivation for rewriting the parent statement. Abstracting away the type of counter and just saying, "show the number only when you crossed it" basically.

Re: Why the iPhone Timer app displays a fake time

#34
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.)

Correctly rounding to the nearest second is exactly the behaviour that I expect from a timer.

It's not "fake".

Re: Why the iPhone Timer app displays a fake time

#35
post #11

Earlier quoted context omitted.

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 m…

[deleted]

Re: Why the iPhone Timer app displays a fake time

#36
post #24

Maybe 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 "f…

Yo. 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.

I have seen a lot of comments on Hacker News that I thought were mean. This isn't one of them.

Rounding is something I learned in elementary school. If someone in elementary school was unfamiliar with rounding, it would be mean to take them to task about it. But this writer is an adult, a professional programmer, and presumes to be a teacher, by taking the time to publish an article about the subject.

In fact, the writer has even less excuse, because he knows about rounding. Twice he mentions "rounding down". So it is all the more baffling that he did not call what Apple was doing, simply, "rounding up". Instead he wrote a multi-paragraph blog post about adding 500 milliseconds of "fake time", then having to duct-tape over that by making the timer say "0" when the timer reached 500 ms.

Suppose a man bills himself as a car salesman, but every question you ask him about the car, he says the wrong thing. He says the car has 3 wheels when it has 4. He says it is red when it is black. He says the engine is in the back when it is in the front. Would it be mean for you to mention his title, by saying something like, "You say you are a car salesman, but you don't know about this car on your lot." It is right to call someone out for being less than what they say they are.

As for random blog posts on the internet, this isn't so surprising. What's surprising is that it wound up on Hacker News with over 100 votes.

Re: Why the iPhone Timer app displays a fake time

#37
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.)

Correctly rounding to the nearest second is exactly the behaviour that I expect from a timer. It's not "fake".

Unless you pause it... In which case it rounds up...

Re: Why the iPhone Timer app displays a fake time

#38
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.)

Correctly rounding to the nearest second is exactly the behaviour that I expect from a timer. It's not "fake".

Exactly. 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.

Re: Why the iPhone Timer app displays a fake time

#39
post #28
post #24

Earlier quoted context omitted.

Yo. 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.

Mature 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.

Assuming productive criticism, yes. IMO the comment in question wasn’t that. E.g remarks about author’s bio seem random and unnecessary to me.

Re: Why the iPhone Timer app displays a fake time

#40
The 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.

Post reply on HN