Live data from Hacker News

Falsehoods programmers believe about time

infiniteundo.com

201–210 of 212 posts

Re: Falsehoods programmers believe about time

#201
post #10

> There are always 24 hours in a day. Is this referring to leap seconds or what do the mean?

When the timezone changes for daylight savings time, you either lose or gain 1 hour in that day (or whatever your local equivalent is).

Except for Lord Howe Island in New South Wales, Australia, where local time changes by 30 minutes.

Re: Falsehoods programmers believe about time

#203
post #195

Earlier quoted context omitted.

As a 1995 immigrant, I understand what am/pm time it is 22 hours of the day, but I'm still not sure about those two 12:* mystery hours. I know, I can look it up, and I have several times. But the knowledge doesn't stick...

You have to look at it as a separate concept from the hh:mm time, pm is between midday (inclusive) and midnight (exclusive) and am the rest, between midnight (inclusive) and midday (exclusive).

Right. When I do remember, that's the rule I use.

The ambiguity of midday and midnight is really the cherry on top of this masterpiece of confusion.

There is probably some part of me too offended by this system to want to remember it...

Re: Falsehoods programmers believe about time

#204
post #121

> The system clock will always be set to the correct local time. I work on a sometimes offline educational product for children. Kids for some reason love to mess with their system clocks. The hoops we've tried jumping through to get a reasonable time frame of events from iPads that were offline for any period of time is hilarious. We gave up, and if the time of events is unreasonable, we just shift the entire set wa…

My dad has some insomnia problems and used to play a lot of Candy Crush.

His iPad was like 2 centuries ahead because moving the system time would give him extra lives. He couldn't practically move it back because then he'd have to wait another 2 centuries to get lives again. So his iPad was 2 centuries ahead until he completed Candy Crush.

Re: Falsehoods programmers believe about time

#205

Earlier quoted context omitted.

As a 1995 immigrant, I understand what am/pm time it is 22 hours of the day, but I'm still not sure about those two 12:* mystery hours. I know, I can look it up, and I have several times. But the knowledge doesn't stick...

Post median, ante median. Translation: After midpoint, before midpoint. Also the difference in the cycles comes from analog clocks. I can explain all of this but it's still confusing and stupid to have to deal with it in 2022

I would argue that 12:30 hours after midpoint is exactly that: there is the midpoint, and then you add 12 hours and 30 minutes. So 12:30 PM would be 00.30 military time according to that logic.

As a non-native am/pm user: it's confusing. Even with that rule.

Re: Falsehoods programmers believe about time

#206

Just wait till you hear about leap seconds. At my previous job matching datapoints on timestamp was crucial, so we did a lot of fun things with time. Leap seconds cost us 3 months of testing.

Meta (among others) want to change that.

https://engineering.fb.com/2022/07/25/production-engineering...

Re: Falsehoods programmers believe about time

#207
post #181

Earlier quoted context omitted.

During the last “fall back” event I experienced the 1 o’clock hour three times since I randomly happened to cross a time zone at exactly 2:00am…or maybe 1:00am? The worst part was I had an appointment at 02:00, somewhere where they won’t let you in if you show up too early, in the other time zone and hadn’t had to deal with daylight savings time for a good long while having lived in Arizona where they don’t deal with…

> having lived in Arizona where they don’t deal with such silliness Oh god, I'm simultaneously delighted at the idea of not having to deal with DST and terrified of writing software that might have to keep track of whether or not the user was in Arizona during a DST transition.

Parts of Indiana have the same issue. Notice I said parts and not all - there are parts of Indiana that observe DST because they border with states observe DST and it's to their advantage to stay in the same time zone. What a mess! Just makes writing software that much more difficult!

That's why in the utility business it's common to use the language of standard time, daylight saving time, and prevailing time. For the Eastern timezone they write it as EST, EDT, EPT respectively. The important point is EST and EDT never vary - they'e fixed offset from UTC (UTC-05:00 and UTC-04:00, respectively). EPT is the squirrelly one - sometimes it matches EST and other times it matches EDT. At least when processing a time interval you know whether you have to take clock movement into account.

Re: Falsehoods programmers believe about time

#208
post #162
post #146

Earlier quoted context omitted.

Sure—changed from https://gist.github.com/timvisee/fcda9bbdff88d45cc9061606b4b... now. Thanks! (For some reason people think we know these things)

Falsehoods hn'ers believe about dang…

1. Dang is subject to the normal rules of time and space.

FALSE: Dang is a cosmic entity of Lovecraftian proportions who exists outside of and beyond our pitiful human conceptions of "time" and "space." Dang is eternal, dang is everywhere, dang is everything.

Re: Falsehoods programmers believe about time

#209
post #197
post #189

Earlier quoted context omitted.

No, they are not. Beyond leap years and leap seconds, I know absolutely nothing about time, how to handle all the "daylight savings" and other kind of bullshit. And I actually do not care, at all. Luckily for me, people who do care and know these things have made libraries that can handle it all while expecting only minimal knowledge from me, such as being aware that time zones exist at all.

The reason why you use those libraries is that you know time is difficult and you need to be cautious. You don not blindly believe those statements about time. If pressed to answer whether they are right or wrong you would say that you are not sure.

And I'm not sure how this contradicts what I wrote.

Re: Falsehoods programmers believe about time

#210

Obviously nobody believes most of these falsehoods. Presumably the op means a lot of programmers create bugs that seem t imply programmers believe these falsehoods. But this one jumped out at me: "Any 24-hour period will always begin and end in the same day". It would be a lot more plausible if "always" were replaced with "never". Add 24 hours to a time, and it will (almost) always be the next day.

Agreed on all counts. The “falsehoods programmers believe about X” articles are cautionary lists of edge cases to think about, with an unfortunately aggressive naming scheme.

Falsehoods programmers Considered harmful
Post reply on HN