Live data from Hacker News

Why the iPhone Timer app displays a fake time

lukashermann.dev

61–70 of 83 posts

Re: Why the iPhone Timer app displays a fake time

#61
post #57

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

You can still edit them, just tap edit in the top left and then the alarm. Why we can’t just tap the alarm and save a step I don’t know. The small text input UI instead of the old scrolling thing (I’m aware it still scrolls, just harder to use) is terrible though.

Re: Why the iPhone Timer app displays a fake time

#62
post #49

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

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

Re: Why the iPhone Timer app displays a fake time

#63

Earlier quoted context omitted.

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.

Sorry. First, I thought that you set out to contradict, rather than agree with, the person you replied to (since that is common). Then I was thrown off by your topic sentence, which seemed to lump together the two devices ("timers and stopwatches"). At this point, I think my reading accelerated to highway speeds and totally botched parsing the rest ;)

Re: Why the iPhone Timer app displays a fake time

#64
post #62
post #49

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

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

> However, this would result in 59.51s being displayed as 0:60, though it should be 1:00.

They would round it up to 60, the format it to be 01:00.

Re: Why the iPhone Timer app displays a fake time

#65
post #62
post #49

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

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

> However, this would result in 59.51s being displayed as 0:60, though it should be 1:00. Rounding up has the same problem.

Surely one shouldn't round _after_ splitting the time into minutes and seconds.

You floor() or ceil() the time, depending on if you're counting up or down, to the lowest unit your timer is showing, then you display it and in the process split it into hours, minutes etc.

So ceil(59.51s) = 60s, which is then converted to 0h 1m 0s for display.

Re: Why the iPhone Timer app displays a fake time

#66
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.

You don’t need to put others down to boost yourself. Isn't that exactly what you did right here?

Yes, it is.

Re: Why the iPhone Timer app displays a fake time

#67
post #62
post #49

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

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

> this resulted in 51.0s being displayed as 1:51

What?

> with rounding up it's even worse resulting in 1:01:51

Huh?

If you are making some kind of timer, you first should convert the time to pure seconds, or in whatever the smallest unit is that you care to deal with (milliseconds?). It is only at that point that the data is ready for any kind of arithmetic (for example, to subtract 1 second). Then, when you wish to display it, you first convert it.

For example, if the user sets your timer to 2 minutes, you would convert "2:00" to 120 seconds. Then you subtract 1 second. Now the internal value is 119. Then you convert back to the display format: "1:59". But be sure to keep "119" in some internal variable, for the next change.

    
        
        
        
        
        
    

    

    document.forms.f.addEventListener('submit', function (ev) {

        ev.preventDefault();

        let f = ev.target,
            s = Number(f.h.value * 60 * 60) +
                Number(f.m.value * 60) +
                Number(f.s.value);

        function show(f, s) {

            let h = Math.floor(s / 60 / 60);
            s -= (h * 60 * 60);

            let m = Math.floor(s / 60);
            s -= (m * 60);

            m = String(m).padStart(2, '0');
            s = String(s).padStart(2, '0');

            f.elements.r.value = [h, m, s].join(':');
        }

        show(f, s);

        if (f.timer) { clearInterval(f.timer); }
        f.timer = setInterval(function () {
            if (0 === s) { clearInterval(f.timer); return; }
            s -= 1;
            show(f, s);
        }, 1000);
    });

    

Re: Why the iPhone Timer app displays a fake time

#68
post #57

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

I guess I'm with sibling commenter that I must use Siri to set my alarms for the last few iOS versions, because I just opened it to see what you're on about (I mean, c'mon, that UI is fine) and...OMG, you're right. What tiny-fingered designer thought that time field was acceptable? The only thing they seemed to have gotten right is allowing the direct typing of digits to set a time. The rest? Exactly the hot mess parent describes.

Re: Why the iPhone Timer app displays a fake time

#69
post #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 per…

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

Re: Why the iPhone Timer app displays a fake time

#70
post #10

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

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

Conceptually you are attempting to display something that has more precision than you are willing to display.

You can

   - Round (Truncation is a type of rounding, Rounding towards zero)
   - Adjust the display to increase the precision it displays
   - Do both by dynamically increasing the precision of the display/decreasing rounding as the distance to zero closes in.
Post reply on HN