Live data from Hacker News

Falsehoods programmers believe about time and time zones

creativedeletion.com

31–40 of 83 posts

Re: Falsehoods programmers believe about time and time zones

#31
post #19

It bothers me that a minute is not always 60 seconds. For leap seconds why did we choose 23:59:60 instead of 24:00:00? If we had went with the latter we also solve the daylight savings time problem. A day would last until 22:59:59 or 24:59:59 depending on the time of year. It seems like a lot of things would be simpler that way. Does anyone have a better understanding of why things ended up this way?

> It bothers me that a minute is not always 60 seconds. For leap seconds why did we choose 23:59:60 instead of 24:00:00? But how does this solve the problem? Sure, 23:59 is now 60 seconds long, but the minute 24:00 is only 1 second long.

It's about consistency. 23:59:60 is introducing a special case to the seconds field which you have to account for. 24:00:00 only adds a second to the day where it naturally should go. I don't redefine what a minute is, a minute is always 60 seconds. You are confusing two separate ideas, displaying a time and finding the difference between two times. Lexically you wouldn't say that minute is 1 second long, you would say that the day ends on the first second of the last new minute.

Re: Falsehoods programmers believe about time and time zones

#32
So this is all pretty obvious once you look into the history of "time" as we measure and record it.

Two of the best resources on this topic that I've come across are:

A PyCon presentation - "Blame It On Ceasar" https://www.youtube.com/watch?v=GBKqRhn0ekM

A Book - "TIME – From Earth Rotation to Atomic Physics", by Dennis D. McCarthy and P. Kenneth Seidelmann, (Not a cheap book most places you can find it but it is worth it.)

The book left a permanent impression on me with respect to fundamentally understanding the physicality of time as an aspect of the universe we exist and are attempting to measure every time we record the time something takes to happen.

Re: Falsehoods programmers believe about time and time zones

#34
post #5
post #3

Earlier quoted context omitted.

It's extra tough to know what to do on that situation if you don't know the provenance of the timestamp, because there are some programs that output timestamps formatted like a POSIX TZ, but with the opposite sign convention.

Indeed. If you just have a random timestamp, no clue what it is. Another reason why you should generate ISO 8601 timestamps if possible, but they are not so nice for humans reading (or even worse, writing) them.

Its a matter of practice, but on the odd occasion, I've wound up accidentally dating a document with a handwritten full ISO 8601 timestamp, usually happens when I have to sign and date something after spending several hours making notes while reading log files.

Re: Falsehoods programmers believe about time and time zones

#35
post #27

Would it be too much to have a global movement for uniform time standards? No half-hour timezones, no daylight savings, no leap seconds, just easily predictable time. Calendars are supposed to be convenient, and right now our ancient conventions make it difficult to understand each other (not just computers; think of travelers having to adjust to timezones, "do I need DST or not?"). At least, lets think of the electr…

Swatch Internet Time is going to really take off one day....

https://en.wikipedia.org/wiki/Swatch_Internet_Time

Re: Falsehoods programmers believe about time and time zones

#36
post #25
post #21

There is a video by Computerphile ( https://www.youtube.com/watch?v=-5wpm-gesOY ) which in an entertaining way explains time zone problems.

That is one of my all-time favorite youtube videos... This one, and a similar one on unicode[1], are my goto exhibits when I need to illustrate to a non-technical family member how much background complexity is involved in software [1] https://www.youtube.com/watch?v=MijmeoH9LT4

I would think the time zone example would go over better than Unicode, because it's less esoteric. Almost everybody deals with time zones at some point; not everybody deals with Unicode.

Re: Falsehoods programmers believe about time and time zones

#37

My bete noir isn't in the list: GMT is only the UK timezone for about half the year. During the Summer, GMT continues to exist, but the UK time is BST.

You are confusing two things. A time zone (e.g. Europe/London) is a geographical region of places always sharing the same time and it does not change at a given location unless time zones come and go. The zone time (e.g. GMT or BST) on the other hand is the time in use in a given time zone at a given point in time and it commonly changes twice a year between normal time and daylight saving time and back. In short, daylight saving time affects the zone time, not the time zone.

Re: Falsehoods programmers believe about time and time zones

#38
May I suggest adding "my users are in the same time zone as I am". Automated tests are often written with this implicit assumption too.

I recently fixed a bug for a local hire service I use frequently. I'd made the booking in Seattle, and they were 18 hours late when I got back to Melbourne...

Re: Falsehoods programmers believe about time and time zones

#39
I'll add one: "But surely each place only has one DST each year…"

Nope. Troll Station in Antarctica has four different settings through the year.

Personally since there are only 40 people there I think they should just suck it up and pick two. They are probably causing a lot of software bugs. I know they cost me a couple hours.

Edit: Oh crum, I see Morocco suspends DST during Ramadan, so they have four settings too… and 33 million people. I can't ask that many people to change, it would take too long.

Re: Falsehoods programmers believe about time and time zones

#40

Earlier quoted context omitted.

"(Sorry about that, but we can’t show files that are this big right now.)" 1.3MB and it's actually raw code. Amazing.

Daylight Savings Time should die in the fires of hell.

I couldn't agree more - to boot, DST going away solves like half of the edge cases with one quick fix.
Post reply on HN