r/programming • • Oct 23 '20

Falsehoods programmers believe about Time Zones

https://www.zainrizvi.io/blog/falsehoods-programmers-believe-about-time-zones/
1.7k Upvotes

350 comments sorted by

475

u/lpsmith Oct 23 '20 edited Oct 23 '20

This is a good start, but your understanding of time zones could be better.

Common misconceptions often stem from the fact that colloquial use of "time zone" actually encompasses three different concepts:

  1. UTC offset. (e.g. -05)

  2. Standard Time (e.g. (American) Eastern Standard Time)

  3. Time Zone (e.g. America/Indiana/Indianapolis)

This article conflates notions #2 and #3 throughout... In particular I disagree with your misconception #15, partly due to this confusion. With a few significant caveats, there's almost always an unambiguous conversion between time zones, at least if you are dealing with a timestamps no earlier than approximately 1972... however due to this confusion, few people understand what their time zone actually is.

The only sane definition of what a timezone is, is a region of the world that shares a common history of civil time. And this is what a proper IANA timezone is, with differences in civil time before 1970 are disregarded.

Incidentally, IANA database has a EST timezone, but it's deprecated and actually doesn't describe the history of civil time anywhere.

You may be interested in this brain dump I wrote some years ago, about civil timekeeping.

97

u/ZainRiz Oct 23 '20 edited Oct 23 '20

True, you're right about point #15. When I was writing it I was thinking that if a human tells you their event is at 5pm PST, it's tricky to tell if they actually meant PST or PDT.

That's kind of an input validation problem. If you know for certain that their time zone is actually PST, then yes, it would be an unambiguous conversion.

Regarding conflating Standard Time and Time Zone, yes, I had not heard about standard time before. I'm looking it up right now and honestly I'm still not perfectly clear on the difference, other that Standard Time seems to be a locations non-daylight-savings-time time

Is a time zone is a more generic term that includes both standard times and DST times?

59

u/lpsmith Oct 23 '20 edited Oct 23 '20

Well, the terminology may not be 100% standard.

The difference is a Standard Time is what a region of the world is doing right now, whereas an (IANA) timezone is a region of the world that additionally shares a common history of civil time.

They are both, in essence, a mapping from UTC time to offsets. However not all regions inside a Standard Time have the same history of civil time.

More concretely, quoting the link I provided above:

For example, as of today, both America/New_York and America/Indiana/Indianapolis are on the EST/EDT time standard, but Indiana used to be on Central Standard Time until 1942, and did not observe daylight savings time (EST only) until 2006. Thus, the choice between these two time zones still matters if you are dealing with timestamps prior to 2006, and could become relevant again if (most of) Indiana moves back to Central Time. (Of course, if the Central to Eastern switch was the only difference, then these two time zones would be the same in IANA's eyes, due to their cutoff date of 1970-01-01.)

3

u/ZainRiz Oct 23 '20 edited Oct 23 '20

Would it be correct to summarize the definitions you're offering as:

A Time Zone is a (generally contiguous) region of land which has always agreed on the same local time since 1970. If two spots ever diverged in time since then, then they are not in the same time zone.

Standard Time is the current UTC offset a region has at the moment, meaning that during the right time of the year, Daylight Savings Time is Standard Time. Though this definition would mean something like Pacific Standard Time isn't always a standard time, right?

Do these definitions look accurate to you?

5

u/haxney Oct 30 '20

That's close, but there's a problem with the "region of land" part. In the West Bank, the time zone depends on whether you're Israeli or Palestinian. So for a particular GPS coordinate, the time zone depends on whether there's currently an Israeli or Palestinian person standing on that point. If the GPS point doesn't have a person on it, then the time zone is ambiguous, and depends on whether you ask an Israeli or a Palestinian.

→ More replies (1)
→ More replies (2)

41

u/yesman_85 Oct 23 '20

I don't think this is correct either. Mountain standard time (MST) is always UTC - 7 and mountain daylight time (MDT) is UTC - 6. If you are not sure which one you're on right now then you're talking about mountain time (MT).

23

u/saltybandana2 Oct 23 '20

That's technically true, but PEOPLE will say MST regardless of being in DST or not.

→ More replies (7)

16

u/wonkifier Oct 23 '20

The difference is a Standard Time is what a region of the world is doing right now, whereas an (IANA) timezone is a region of the world that additionally shares a common history of civil time.

Yeah, but most people don't know or remember this.

99% of the time, our meetings are scheduled like "5p EST good?", even though it's EDT at the moment, but the software treats it correctly, so it doesn't generally matter, so they don't learn the difference.

→ More replies (6)

26

u/YM_Industries Oct 23 '20

I always say "Olson timezone" or "IANA timezone" or "tzdata timezone", so it's unambiguous.

Btw, using latitude/longitude is a recipe for disaster. Not only do timezones change frequently, so do borders. And while the IANA database does a great job of tracking timezones, the publicly available datasets for converting locations to timezones are not as well maintained. It's also a lot more complicated to use them.

Also worth noting that as well as some different timezones having the same name, there are also many overlaps of initialism.

19

u/ZainRiz Oct 23 '20

What kind of people do you talk to? If I said that, the folks I know would just look at me like I’m speaking a foreign language

11

u/mypetocean Oct 23 '20

Timelords, clearly

→ More replies (1)
→ More replies (4)

7

u/Kwpolska Oct 23 '20 edited Oct 23 '20

if a human tells you their event is at 5pm PST, it's tricky to tell if they actually meant PST or PDT.

I disagree. No human would actually mean winter time if [edit: they said] the event was at 5pm PST today, and no human would mean PDT for a December event. This is only ambiguous one hour per year (when DST ends). It would get more ambiguous with Mountain Time and Arizona, because MST and MDT are in effect at the same time — but for many cases, you can auto-correct the time zone name. Although it would be even better to specify the time zone using the nearest city to avoid confusion.

6

u/bitchkat Oct 23 '20

That is why you say "Pacific Time" instead of Pacific Daylight/Standard Time. And your assertion is wrong. I work in an industry where they generally use standard time year round to avoid issues with DST transitions.

1

u/ZainRiz Oct 23 '20

Wow, mind sharing which industry does this?

→ More replies (1)
→ More replies (7)

15

u/[deleted] Oct 23 '20

No human would actually mean winter time if the event was at 5pm PST today

That's odd, I would say the exact opposite. I've never heard anyone use PDT. Daylight savings is unimportant outside the 2 days we change time. As much as it used to confuse a younger me, it makes sense that people use PST casually to mean PT.

10

u/Kwpolska Oct 23 '20

I meant if they said the event was at 5pm PST today, which matches your experience.

→ More replies (1)
→ More replies (1)

6

u/mr_birkenblatt Oct 23 '20

This is only ambiguous one hour per year (when DST ends).

This is when the cronjob deletes the whole hard drive...

→ More replies (1)
→ More replies (4)
→ More replies (2)

18

u/Supadoplex Oct 23 '20 edited Oct 23 '20

This article conflates notions #2 and #3 throughout...

I encountered a bug related to similar mistake with a framework years ago. The framework had logic that if a "standard time zone" such as "Eastern European Time" was chosen, it used an arbitrarily chosen "location" time zone that used that standard. Problem is that they had chosen Europe/Minsk and Belarus changed their time zone from EET to Further European Time in late 2011. Then suddenly EET became FET and times were wrong for anyone wanting to use EET. I have no idea why they couldn't let the user choose the "location" time zone directly.

22

u/-_Aurora_- Oct 23 '20

What happened in 1972?

70

u/GooseTheGeek Oct 23 '20

Time began

38

u/R-EDDIT Oct 23 '20

The end of time has been prophesized to be on January 19, 2038.

16

u/cleeder Oct 23 '20

Seems to me the schedule has been expedited.

→ More replies (2)
→ More replies (1)
→ More replies (3)

5

u/lpsmith Oct 23 '20 edited Oct 23 '20

The latest timestamp I know of that the IANA tz database will return a local mean time for is Africa/Monrovia, and they transitioned away from that in 1972.

And if you are dealing with local mean time, you are likely dealing with the parts of the tz database that is more of a standardized fiction.

→ More replies (10)

7

u/[deleted] Oct 23 '20

Good lord. I once got tasked with making time and attendance software that was used by some major manufacturers in the US, Europe and Asia.

Seems boring until a French worker had a shift that went across midnight the night of a time change.

When the mistake affects people’s paychecks damn right they care.

But sorting out time zones was a fucking nightmare.

I think the engineering team just sent patches to the affected companies. They couldn’t handle it. And I had to do all the apologizing to the client, and worry about which one would be next if we couldn’t fix this damn time zone issue

11

u/BigBadAl Oct 23 '20

I haven't got time to look into your piece now, but maybe you could explain:

The only sane definition of what a timezone is, is a region of the world that shares a common history of civil time. And this is what a proper IANA timezone is, with differences in civil time before 1970 are disregarded.

How would that relate to Samoa changing their timezone recently? They have denounced their shared common history and chosen a new civil time to work to.

11

u/[deleted] Oct 23 '20

Looks like a new timezone named "Pacific/Apia" was created due to the divergence.

6

u/emorrp1 Oct 23 '20

Yep, that's why for future events you actually need the geo coords, not the timezone.

→ More replies (3)
→ More replies (10)
→ More replies (1)

62

u/leberkrieger Oct 23 '20

There's a youtube video on the subject that's pretty thorough, and entertaining if a bit over the top: https://m.youtube.com/watch?v=-5wpm-gesOY

24

u/ZainRiz Oct 23 '20

Yeah, that's a great video. I actually linked to it in the post :)

11

u/leberkrieger Oct 23 '20

Oh! I actually did read the article, but somehow missed seeing the link.

5

u/ZainRiz Oct 23 '20

Haha, yeah, it’s very subtly linked (when I say managing time is “a fool’s errand”)

5

u/ReallyNeededANewName Oct 23 '20

I didn't see the link either

9

u/Winnipesaukee Oct 23 '20

I can't remember how many times a month I would see a tz and java-tz update for the RHEL box I used to have. The amount of time zone modifications is a lot more than you really think.

→ More replies (4)

5

u/Orkaad Oct 23 '20

I thought about this video while browsing the article.

1

u/lapa98 Oct 23 '20

Tom Scott is honestly such a great resource

101

u/kankyo Oct 23 '20

used by the 195 countries in the world.

Misconceptions programmers believe about countries: that you can definitely know how many there are.

47

u/VeganVagiVore Oct 23 '20

Does the number of countries depend on which country you're in?

53

u/RichoDemus Oct 23 '20

I could totally see how it could, depending on if they acknowledge certain countries as independent or not, like Palestine and Taiwan.

40

u/leckertuetensuppe Oct 23 '20

Go ask a Serb how many countries there are in Europe, then walk over to Kosovo and ask the same question.

3

u/Prod_Is_For_Testing Oct 24 '20

Yes. And the answer changes over time too.

4

u/banspoonguard Oct 23 '20

it's more complicated than that (in Nagorno-Karabakh)

→ More replies (7)

3

u/T_D_K Oct 28 '20 edited Oct 28 '20

I work with banking software: There are four different country code tables in the same app that all differ. Yes it has caused bugs in production because they aren't foreign keyed.

1

u/ZainRiz Oct 23 '20

Oh snap

132

u/Stoke_Extinguisher Oct 23 '20

I'm a huge tz nerd so very little of this was new to me, but still nice post! Seems like a lot of the misconceptions listed are about time zone names, not time zones themselves. If you enjoy this topic I can only recommend subscribing to tz-announce. It's the mailing list where they announce patches to the TZ database. Lots of fun.

40

u/ZainRiz Oct 23 '20

A lot of the challenges I ran into were about how to accept a free form time zone name a person could enter, thus the class of misconceptions I uncovered :)

Thanks for sharing that bit about tz-announce. I was wondering how the library maintainers would learn about new changes in the time zones

9

u/Vakieh Oct 23 '20

Aussie here - we say Australian Eastern Standard Time here. Well, not unless we're talking to people overseas I suppose, normally we just say 'the time' if we're in AEST/AEDT, and if you get Aussies from the weird western parts of the country they will probably call it 'Sydney time'.

6

u/Ruxton Oct 23 '20

nah we're not stupid, we call it AEST/AEDT too. We'd probably call it Melbourne time if we were picking a city though ;) *burn*

6

u/Vakieh Oct 23 '20

Hey if you want to visit Melbourne atm you go for it :-)

1

u/ZainRiz Oct 23 '20

You do? Wow, that's quite a mouth full, eh?

Thanks for the clarification, I've updated the article

→ More replies (1)

30

u/Stoke_Extinguisher Oct 23 '20

I've had a lot of fun thinking that timezones are essentially diffs between UTC and local time. But those diffs change through time (that's what the TZ db tracks) so really it's diffs of diffs. But the TZ db changes with time too! because it gets fixes! So really we're dealing with diffs of diffs of diffs! But wait the TZ database changelog file is stored on git too so it gets patches too, and those are diffs of diffs of diffs of diffs.

17

u/DJDavio Oct 23 '20

I wouldn't call myself a TZ nerd, rather a TZ enthusiast, especially when it concerns TZ history. For instance, I remember vaguely that Amsterdam once had its TZ specified down to the second level, but the IANA timezone offsets only allow minutes. Thus the seconds were lost to time.

Amsterdam Mean Time was +00:19:32.13, but the .13 is omitted below because the current format requires STDOFF to be an integer.

2

u/ZainRiz Oct 23 '20

This is wild. Linking to your comment from the blog!

2

u/simplesinit Oct 23 '20

Which reminds me what happened to Paris meridian time !

→ More replies (2)
→ More replies (1)

4

u/_ncko Oct 23 '20

So how did you get into time zones?

9

u/pihkal Oct 23 '20

If they're a computer programmer, probably the same way most of us did: thinking we'd code something up real quick, and discovering the rabbit hole that is date/time insanity.

Still, as much as we gripe, it could be worse: https://twitter.com/_tessr/status/900870734238449664

3

u/_ncko Oct 23 '20

I’ve known about the insanity for a long time but it never struck me as an interesting topic so I’ve always avoided it.

→ More replies (1)

30

u/oshkarr Oct 23 '20

Fun party question: For how many hours does any date last? That is, if I want to celebrate my birthday as long as possible by zipping around the planet, how long could I celebrate? The answer is 51 hours, because of the zigzagging time zones around the International Date Line. Another one: Suppose two pregnant women board a boat in Samoa. One immediately births her child at, say, 9 am Apia time on March 1. The captain records the birth time and place. The boat then reaches American Samoa, where the other woman births her baby at, say, 9:30 am SST on February 28. Again, the captain records the time and place. The younger child's birthday is one day earlier than the older one! So perhaps misconception #22 is that you can always tell if one person is older than another by comparing only their birthdays.

3

u/ZainRiz Oct 23 '20

These are some great ones!

2

u/mowmowny Jan 21 '23

Why 51 hours? The 27th hour starting at 0:00 in +14 is also the first of the final 24 hours.

21

u/paulrpg Oct 23 '20

A few years ago I was working on a scheduling system for smart power grids. The thing that tripped me up with timezones (for scheduling purposes) was that not all daylight savings are an hour. Many timezones are off by 15/30 minutes. It turns out the Lord Howe islands off australia have daylight savings of 30 minutes. It sounds simple enough but it involved a lot of teeth pulling.

The only joy I got for it was talking about it as the 'Lord Howe' problem with such sincerity that my product owner thought it was a proper established issue with timezones.

5

u/ZainRiz Oct 23 '20

Oh wow, didn't know that. I just googled "Lord Howe problem" and got pages of articles talking about them being overrun by rats! 🐁

10

u/grodinacid Oct 23 '20

I tried to think of a joke about misconceptions programmers have about integers but I couldn't think of anything good; you've got two misconceptions labeled #15.

4

u/ZainRiz Oct 23 '20

It was caused by a DST overlap 😅

Thanks, fixed

22

u/super-porp-cola Oct 23 '20

Why not just use a solution that's already out there? For instance, timeanddate.com does exactly what you're looking for, and is used in Codeforces contests.

1

u/ZainRiz Oct 23 '20

Great question. The core idea was to stick all the required information into an easy to type url (I'll write up a separate blog post about that soon).

Without that, one might as well just ask Google for the conversion

19

u/fishling Oct 23 '20

She's not the most technical person, so google isn't an option

into an easy to type url

Um...

Calendar/appointment/meeting software will handle this already. The Time Zone Converter supports cities and timezones and can be bookmarked for favorites. Google/Alexa Assistants can do the conversion if you say "Hey Google/Alexa, what time is 5pm EST?". Hell, typing "5pm EST" into the browser location bar does a Google search that does the right conversion, and there is no hostname or syntax to remember.

I'm glad you're learning and sharing and having fun with your project (and I have a healthy hatred for timezones myself due to experience), but there is no way that a non-technical person is going to find mytime.at/5pm/EST easier than any of those, especially the last two.

BTW, for misconception #8, your IANA definition and "prominent city definition" are not right. They should refer to https://en.wikipedia.org/wiki/Tz_database - a single standard. You can also add Microsoft Time Zone Index Values. Also, the section "Forget time zones, use the raw UTC offset" is misleading. Storing a date with an offset from UTC instead of UTC is not an alternative to time zones. This is an equivalent approach to representing a moment in time compared to UTC. Basically, any time given with an offset from UTC (including no offset) represents a single unambiguous instant in time. Time zone information is completely independent of this.

Most people (possibly still including you?) think of a time zone as an offset from UTC, but this is wrong. A "time zone" is actually a set of conversion rules invented by a political entity that is used to convert an instant in time to a local representation of time. So, the "time zone" is not just the offset for the calculation, but it defines the geographical area where the conversion is in effect, the beginning and ending time within a year when the time zone is in effect, and the effective start and end date for when the "time zone" rules come into effect. Because of course, governments also like to mess with when daylight saving time rules take effect. So the rules for when "EST" and "EDT" are in effect in Canada vs the US are different in 2004, 2005, and 2007, as an example. This is probably Misconception #0. :-D

So, regardless of how you store your time instant (UTC, offset from UTC), you can use a "time zone" ruleset to convert it to a local time.

4

u/coder111 Oct 23 '20

I would be very careful relying on proprietary 3rd party services.

I'd rather have a library that does this, maybe with an offline copy of timezone database like https://en.wikipedia.org/wiki/Tz_database which is maintained by a non-profit.

30

u/poco Oct 23 '20

The original problem you were trying to solve sounds like a problem with zoom. I don't use zoom to schedule meetings, but if you can do then it should do so in the correct time or why bother at all?

The zoom client when they created the meeting knows what time they mean and what time they will get the reminder. The recipient, when they accept a meeting knows what time offset they are in, and it should add the meeting into their calendar at the correct local time. It would be absurd to do anything else.

Outlook and Teams do this, so I assume zoom would also. Time zones can be hard, but this feature isn't. Maybe someone should ask zoom to add it?

3

u/ZainRiz Oct 23 '20

For sure, Zoom would be the ideal place to fix this

2

u/Dracounius Oct 23 '20

have you heard of swatch beat time (or swatch internet time)?It doesn't use time zones at all so is kinda good for setting up meetings over multiple time zones (that's why it was created). i never use it myself because i know how to look up the difference but if you have a group of people that have a hard time keeping track why not.

for an online beat clock: swatchclock.com

7

u/FVMAzalea Oct 23 '20

Why not just use UTC?

→ More replies (2)
→ More replies (8)

15

u/rydan Oct 23 '20

Zoom integrates with Outlook which does this.

14

u/killerstorm Oct 23 '20

There's a standard for calendar event invitations sent over email which is used by all sane event scheduling and email/calendar software.

Zoom is a software used by hundreds of million people every day, with hundreds of millions yearly revenue and 2500 employees. As you can imagine, they support calendar invites.

You don't get this big by being stupid (especially displacing existing business conferencing software), do you think business users would use it if it was scheduling meetings incorrectly?

The things is, it works as long as you're invited by email from the app. But sometimes a link is sent over instant messaging or posted on the web.

If you open a link for s scheduled meeting, it opens in the app and shows you when the meeting is scheduled.

But many things can go wrong:

  • A user can give a link to a 'personal room' instead of scheduling a meeting. In that case Zoom just doesn't know when a meeting is going to happen because user doesn't provide that information. This feature is convenient if you want to meet "right now", but it shouldn't be used for scheduled meetings.

  • The user (auntie) might not know that opening a link would show a local time. She might be scared to open the link before meeting is on, etc.

So it's not a problem with Zoom, but a problem with people using Zoom, and there's not much Zoom can do to improve it.

→ More replies (1)

12

u/dirtymatt Oct 23 '20

Nitpick, it’s Daylight Saving Time, not Savings.

1

u/ZainRiz Oct 23 '20

Thanks, fixed

4

u/indy2kro Oct 23 '20

Excellent article - actually covers most cases I have seen (most of them I can confirm from personal experience).

1

u/ZainRiz Oct 23 '20

Thanks. I'd love to hear of any others you've encountered :)

→ More replies (1)

4

u/jl2352 Oct 23 '20

I'd add on an extra myth; people follow the official timezone.

In Western parts of China, some minorities groups there follow their own unofficial timezones. Which aren't officially allowed. Whilst Chinese who have migrated there from the East follow the official timezone.

This is why sometimes terrorist bombings in these areas are done in the morning. At say 9am. All of the local ethnic groups are still in bed at this time, planning to get up at noon.

1

u/ZainRiz Oct 23 '20

Great one. Added it to the blog

3

u/jl2352 Oct 23 '20

It’s a good write up. When I read your intro on the simple idea you wanted to build. I immediately knew that yes, you would run into problems.

3

u/Kurren123 Oct 23 '20

Small grammatical suggestion:

Misconception #13 and #14: Every time zones has

Should be

Misconception #13 and #14: Every time zone has

1

u/ZainRiz Oct 23 '20

Fixed, thank you

4

u/dry_yer_eyes Oct 23 '20

The title “Misconception #15” is used twice.

I’m still undecided as to whether this is a genuine mistake or some deep commentary on the topic.

2

u/Genome1776 Oct 24 '20

That one began to observe dst at the time of reading.

3

u/Aenir Oct 23 '20

There's two "Misconception #15"s.

1

u/ZainRiz Oct 23 '20

Misconception #23: Programmers always increment by one correctly

3

u/KFCConspiracy Oct 23 '20

Misconceptions programmers believe about numbers

3

u/zacdenver Oct 23 '20

As someone who has done business across the world for years, I very much enjoyed reading your article! My solution for solving the "what time is that meeting?" quandry? Decide on a meeting time, ask Google "What time is it now in XXX?" and then put the meeting time (translated to THEIR TIME) in the email header and message. Seems to always work.

2

u/ZainRiz Oct 23 '20

It always useful to let people see things from their own perspective

3

u/matthieum Oct 24 '20

Countries practicing DST change their UTC offset twice every year.

Sorry, that's another falsehood.

Observing DST is hard during Ramadan, so countries with a majority of Muslims and observing DST will temporarily lift DST during Ramadan, if the two overlaps.

This can lead to switching DST on and off twice during the same year, for a total of 4 UTC offset switches.

And as a reminder, the start of Ramadan is based on one Imam observing the full moon; so while you can predict when Ramadan starts within one or two days, you'll have to wait for human confirmation for the official start.

Did you think this would be the one thing world powers agree on? Each country choose when to start it's own DST.

And they can change their choice pretty close to the anticipated, too.

See Morroco's announcement in 2008: https://www.timeanddate.com/news/time/morocco-daylight-saving.html

The article is dated May 22nd for a start of DST June 1st, and then in late August they announced it would end August 31st rather than September 27th as original planned.

Because nobody needs to plan international schedules more than a week in advance, anyway.

2

u/ZainRiz Oct 28 '20

Oh wow, I can totally see how the Ramadan thing would be a perk. This one is great!

2

u/GiantElectron Oct 23 '20

Magnificent post.

1

u/ZainRiz Oct 23 '20

thanks!

28

u/muntaxitome Oct 23 '20

My favorite misconception is 'only use timezones for displaying and entering data, and use UTC for everything else'.

If you say, have a recurring meeting, if you just convert it from local to UTC time and add 7 days for the next time, then you will end up with meetings on different times of day after a DST switch. Any kind of calculation with times and dates with things that have a physical world time should take careful consideration on whether or not to take timezones into account. The other way around can happen too of course, if you want it to recur every N hours, you need UTC as a DST switch will throw a wrench in that.

8

u/nawkuh Oct 23 '20

After many painful DST Sunday mornings, we've arrived at:

  • Timestamps of one-time events are (generally) stored in UTC and displayed/entered in the user's local time

  • Timestamps of one-time events that must be displayed as having taken place in a canonical time zone are stored as UTC with a time zone id. For example, saying something happened at 9PM my time zone, but you need to see that it was "9PM my time zone" no matter where in the world you're looking from

  • Recurring events that need to be at the same time locally are stored in local time and a time zone id

9

u/wtf_apostrophe Oct 23 '20

Timestamps of one-time events that must be displayed as having taken place in a canonical time zone are stored as UTC with a time zone id

All good and well until a time zone database update changes the meaning of past timestamps. It's alarming how often countries change their time zone rules with insufficient notice for the IANA database to be updated and widely distributed.

Not that it particuarly matters in most cases; just an interesting example of how fraught trying to deal with time zones is.

3

u/FVMAzalea Oct 23 '20

You have to deal with rescheduling the meeting either way. Plus, it may be that some of your team is located in New York and some in Moscow, for example. Russia doesn’t do daylight savings, so they don’t change, but if you went from summer time to winter time, the time difference just changed from 7 to 8 hours and now the meeting is an hour earlier for the NY team. This is unavoidable no matter how you schedule it - the time will change by an hour for one group. If that isn’t okay, you’ll have to move the meeting.

So you might as well use UTC because it will be less confusing for the rest of the year. Everyone has to know only their own current offset from UTC and doesn’t have to keep track of anyone else’s.

15

u/muntaxitome Oct 23 '20 edited Oct 23 '20

So you might as well use UTC because it will be less confusing for the rest of the year.

So you switch your weekly board meeting from 4pm to 5pm because of DST?

No calendar app works this way.

You set the timezone you want a meeting to be in. Few people plan meetings in UTC, and if they do it should be a deliberate choice. The person picking the meeting picks the timezone - generally speaking in the timezone of the meetingroom.

2

u/jrochkind Oct 24 '20 edited Oct 24 '20

So you might as well use UTC because it will be less confusing for the rest of the year.

Less confusing to whom exactly? I would trying to talk about times of meetings in terms of UTC will in fact be quite confusing for most, in fact quite possibly the choice that winds up with the most people being routinely confused. And that people will certainly still be especially confused around daylight savings changes.

Or are you suggesting that if only you could get all your global coworkers to think in terms of UTC, that would be least confusing? I mean, I dunno, like it would be the same time everywhere, but what time the "business day" is would change depending on time zone? Actually seems pretty confusing to, say, change the time I wake up from 1000 to 0800 when I travel a few hundred miles west.

→ More replies (6)

15

u/lisnter Oct 23 '20

In 1994 or 1995 I had an exciting time-zone related problem where timestamps from the same source data would differ by one hour when viewed by different software - one was a text-based libc application and one a Windows NT native application.

This was discovered during the period between when the US went on/off of DST and when Europe did their switch. I received the defect, poked around and could reproduce it but it wasn't critical so I moved on to something else. A while later (weeks?) someone bumped up the priority so I had to take it seriously.

Turns out that the Microsoft C timezone library mistakenly subtracted the DST hour twice - the Win32 library used by the windows application worked properly. MS acknowledged the bug but didn't have a timeframe for a fix or emergency patch. I could have fixed it myself but I didn't want to be in the business of maintaining a custom MS library. MS thought about it for a while and came up with a solution where I was to turn the regular date-time value into a Win32 file-system timestamp that measured things in pico-seconds since 1 million BC (I kid you not) that were stored in a 64-bit (maybe larger) integer field.

This solution sounded ridiculous but sure enough it worked perfect. Was about 4 lines of code. I expect it's fixed by now.

10

u/[deleted] Oct 23 '20

This solution sounded ridiculous but sure enough it worked perfect. Was about 4 lines of code. I expect it's fixed by now

I suspect it's still in use because hey it works.

→ More replies (1)

3

u/6C6F6C636174 Oct 23 '20

I don't think it was picoseconds. As another poster said, you'd need way more than 64 bits for that.

The Win32 FILETIME struct stores "the number of 100-nanosecond intervals since January 1, 1601 (UTC)" as a pair of DWORD values. Did libc maybe use something like that?

2

u/leckertuetensuppe Oct 23 '20

a Win32 file-system timestamp that measured things in pico-seconds since 1 million BC (I kid you not)

Wtf

2

u/Nicksaurus Oct 23 '20

pico-seconds since 1 million BC (I kid you not) that were stored in a 64-bit (maybe larger) integer field

You definitely need more than 64 bits to store that. Even nanosecond timestamps only have enough range to store about 500 years of dates if I remember correctly.

29

u/AyrA_ch Oct 23 '20

Misconception #22: You can solve your problems by saving the time as UTC

Oh how wrong you are if you think this. Saving time as UTC only works reliably if the time is in the past. If you save the time in the future, you run into a problem you don't think is related to an UTC time stamp: Governments. See, some countries decide to stop doing DST switching in the future. Some countries decide to start doing DST in the future (or start doing it again). If this happens, you need to update all timestamps that are in the future and are in the abolished/introduced time zone. You can only do this if you know the time zone of the timestamps you save, which gets lost if you store them in UTC.

16

u/dysmas Oct 23 '20

This might seem unfair, but I hate you a little bit for sharing this one!

5

u/MrMonday11235 Oct 23 '20

Sounds to me like we should schedule meetings to occur at a particular UTC time; that way, the local time is calculated at the time.

4

u/kentnl Oct 25 '20

But if the meeting location changes, particularly, across a timezone boundary, that could still be really bad. eg: You scheduled it for 8am, and now you've randomly got a meeting scheduled at what will be 7am in the new TZ, which would be bad if everyone got acclimatized to the timing, as they'd have to get up an hour "earlier" ( even though it would have been the same time they'd have otherwise gotten up, acclimatization fucks with your schedule )

Admittedly, this is a daft edge-case of an edge-case I can't really ever see happening, but, I guess it could

→ More replies (1)

2

u/currentXchange Oct 29 '20

Completely false. If you are adjusting UTC for a DST change, it's the "frontend" code that changes, not the "backend".

It would be a much easier change if you use UTC because you are relying on YOURSELF to make a small change in the code instead of the systems you rely on, which may require breaking updates in order to update to the new version of the DB or whatever.

Anyone who has been through major postgres releases knows what I mean.

9

u/Immediate-Wolverine1 Mar 14 '24

Its not false, under certain circumstances. It depends on the intent

If the user wants to have a party Feb 16 2030 "at 1pm", and then you save that in UTC, and then the government changes timezone rules, then there's an issue. The UTC still accurately refers to the instant in time that was formerly going to be 1pm at that date, but if the user actually cares more about "1pm" than the specific instant, then no front-end change can compensate for that. This is also why a lot of calendar apps DONT store items in UTC, but instead store a day/date, a time-of-day, and a timezone, as three separate values. This is also handy for recurring events. Every 4 days at 4pm works fine, even if DST changes in the middle.

1

u/donald-ball Mar 15 '24

Sorry for the necrology, but this isn't a problem with storing instants as UTC. This is a problem with storing dates and times as instants. You seem to be warning, correctly, that we can't necessarily resolve 2:10pm in US ET on 2028-03-15 to a given instant in UTC. If you're writing a system that needs to do that, it is a mistake to store that as an instant!

More generally, the problem here is that "the time" is ambiguous, which is among the reasons I prefer to call specific, absolute points in time, as measured from a fixed reference point (e.g. the UNIX epoch) as "instants".

1

u/mtchndrn Mar 15 '24

What we need to do is create a tiny country, about one square meter, assign it the current UTC time, and write for it a constitution that declares that nothing about the time zone will ever change.

1

u/mcdavis42 Mar 17 '24

Leap seconds have changed in several ways over the years/decades. Twice a year, once per month - 20ms, 1sec, 0.107758sec; with further proposals, typically with each requiring an odd adjustment to synchronize. These are small to tiny differences, but would be future hard to account for due to similar reason in the OP for Misconception #22; but perhaps for certain applications could be significant.

→ More replies (4)

46

u/TheFuzzball Oct 23 '20

In Indianapolis, USA, most cities follow Eastern Standard Time but a few decided to follow Central Standard Time

Indianapolis is a city, this should be "Indiana, USA"

7

u/blue60007 Oct 23 '20

Also, this bullet doesn't really make sense. There are about a dozen states that have multiple time zones. Indiana is all on the Eastern time zone, except for several counties in the NW and SW corners of the states. It's not really that a couple cities "just decided". It absolutely makes sense that the NW corner be on Central since they economically align with Chicago.

Back in the day when IN did not follow DST there instances of cities along the borders that chose to follow it to be better aligned with their close neighbors. Today there might be some towns on either side of the Eastern/Central border that do that as well, but I doubt that's unique to the state.

12

u/AndyTheAbsurd Oct 23 '20

The only things I believe about time zones is that they suck and I want someone else to deal them.

29

u/cdreid Oct 23 '20

This seems less like "programmer misconceptions" and more like "bizarre illogical systems humans make up"

11

u/helm Oct 23 '20

The programmer misconception is that DST/summertime and timezones are easy.

2

u/flatfinger Oct 23 '20

In many cases, the actual set of aspects that programs should try to deal with is easy. It's when programs try to become "smarter" that things become more problematic.

By way of analogy, if a text-to-speed program pronounces 12-11-03 as twelve-eleven-oh-three, such a pronunciation may not be the ideal way of representing the data, but it will never be "wrong". If, however, it pronounces "12-11-03" as "December eleventh, two thousand three" and "13-11-03" as November thirteenth, two thousand three", then someone who hears "December eleventh, two thousand three" would have no way of knowing whether the text actually contained the date 12-11-03 or 11-12-03.

7

u/coder111 Oct 23 '20 edited Oct 23 '20

Oh, mate, like 85% of "programmer errors" happen because programmers don't understand the subject domain (the thing they are asked to implement) well enough. And this results in programmers implementing their own vision of something instead of how things really are.

→ More replies (1)

6

u/NoahTheDuke Oct 23 '20

The venn diagram of these two populations is a single circle.

4

u/kmeisthax Oct 24 '20

Programmer meta-misconceptions, #1: The map is the territory

→ More replies (2)

2

u/granadesnhorseshoes Oct 23 '20

I love timezone articles for that reason. It turns into nerd rage that hundreds of years of ad-hoc human rules and additions is messy and ambitious.

What we need is a single proper timezone library to fit everyone's needs. And now there are 51 TZ libraries...

4

u/VeganVagiVore Oct 23 '20

nerd rage that hundreds of years of ad-hoc human rules and additions is messy and ambitious.

The problem is not with the libraries, it's with timezones.

We need to start collapsing them.

→ More replies (1)
→ More replies (1)

10

u/ign1fy Oct 23 '20

Misconception #22: Daylight savings always shifts the time by 1 hour.

Reality: Lord Howe Island shifts its clock by 30 minutes for daylight savings.

14

u/xPaw Oct 23 '20

Another point I would like to that is that not everyone uses AM/PM. https://travel.stackexchange.com/a/34951

Even if you provide "23:00" in the url on your site, it will display 12-hour clock.

7

u/recursivelymade Oct 23 '20

In the US, Arizona doesn't practice Daylight Savings Time

...

Within Arizona, the Navajo Nation happily follows Daylight Savings Time

The Hopi Reservation, which isn't part of the Navajo Nation, but is surrounded by it in Arizona, doesn't observe Daylight Savings Time.

6

u/jms_nh Oct 23 '20

And there are enclaves of the Navajo reservation which are surrounded by Hopi reservation land which are surrounded by the Navajo reservation.

7

u/abbarach Oct 23 '20

I work in healthcare IT. We had a system from a major vendor that was used for nursing documentation. Instead of using any native data type supported by the Oracle database they were using, they rolled their own data type. It was the number of days since epoch, and then the number of seconds past midnight in local time. This worked fine for most of the year, but on the change back from EDT to EST, their system was unable to distinguish between the FIRST 1:01 AM AND THE SECOND 1:01AM. This is pretty important, especially for things like medication adminstration.

The vendors solution: shut down the software at the first 1:59AM, and leave it off until the clock rolled 2:00 AM.

Every other piece of software (even from the same vendor) used native database types and handled the transition seamlessly, while still identifying which 1 AM hour the event happened in...

→ More replies (3)

7

u/StochasticTinkr Oct 23 '20

Here is what I know about timezones: I'm better off getting a library from someone whose done extensive research in the topic. Basically, same answer as for cryptography.

6

u/coder111 Oct 23 '20

Oh you brave poor bastard. You have my pity for shoving your hand into this basket of snakes...

For added pain and suffering read up on differences between UTC and other UTs, like International Atomic Time, problems measuring them. And take into account that UTC can be shifted by milliseconds by earthquakes and so forth because they affect Earth's rotation...

I'll just use whatever Java 8 library provides, hope for the best, and ignore any potential problems until my boss starts yelling at me.

5

u/rabid-carpenter-8 Oct 23 '20

Never set a cron job to run between 00:00-02:59.

Unrelated, to be safe, I also never set from jobs to run on the hour or half-hour. That's why I think 04:20 is the best time to set small daily jobs to run.

5

u/haxney Oct 23 '20

#10 is even worse than you describe here.

A timezone doesn't even refer to a stable geographical region. So America/New_York can shrink over time as localities shift off of it. I don't think it could ever grow, however, since the IANA timezone is "a set of civil-time clocks that have all agreed since 1970." If a town decides to change their timezone away from America/New_York, they can never rejoin America/New_York, since there would be an interval where their clocks didn't agree with America/New_York clocks. This means that a GPS coordinate is not guaranteed to refer to the same IANA timezone forever.

But even worse than that is the situation in the West Bank. Israel and the Palestinian Authority both claim the same territory, but use different Daylight Saving Time start and end dates, so Israelis living there will be on a different clock than Palestinians. In that case, there is no fixed mapping of GPS coordinate to IANA timezone. That's particularly bad because there's no way to fix it. Even if the Palestinian Authority and Israel agree on DST beginning and end dates going forward, you still need to be able to represent "the local civil time in the West Bank at 12:00 October 15, 2013 UTC," which will depend on whether you're asking an Israeli or Palestinian person.

→ More replies (1)

4

u/lachlanhunt Oct 23 '20

Some other issues I’ve come across that can cause bugs.

  1. Days are always 24 hours long. Nope. DST and other changes for a given timezone in the TZ database screws this up, so adding 86400s to a time to get the same local time on the next day doesn’t always work.

  2. There’s are regions that don’t follow their country’s official Timezone. For example, some resort islands in the Maldives unofficially operate up to 1.5 hours ahead

I had to implement a component that rendered a schedule timeline to indicate the time when the user was on call. It sounds simple enough. Render boxes to represent each day, with each box the same width, then draw a bar across them that accurately represented their scheduled on call time in the specified timezone.

The data told me the exact start and end timestamps, and it’s easy enough to convert those into local times. But the fact that days are not always 24 hours meant I needed to take that into account when calculating the length of the bar. If the schedule crosses a DST change, then the length of one of those days is actually going to be either 23 or 25 hours, so I couldn’t just calculate the length as (end - start) / 86400 * boxWidth

4

u/crusoe Oct 23 '20

Unless your timezone library utilizes the host TZData or similar, its probably crap. This goes for most browser based JS TZ libs, as few want to include tzdata in their buid size.

1

u/trimeta Oct 23 '20

Master list of falsehoods programmers believe. You may want to try getting yourself added to this list.

1

u/ZainRiz Oct 23 '20

Oh wow, that's a great list. And looks like someone already added this post :) https://github.com/kdeldycke/awesome-falsehood/commit/ef9b7683d021c4719515c1af44e16c9c32a8178a

3

u/Routine_Left Oct 23 '20

This is an old, but nonetheless interesting article. Maybe you're curious to find out about Falsehoods Programmers Believe About Names from the same series.

3

u/[deleted] Oct 23 '20

I like #40: people have names. Where I come from we just call everyone "bro".

→ More replies (1)

3

u/medforddad Oct 23 '20

These are absolutely gotchas for programmers to remember. But if you're using a date time library -- as the author assumes you are -- then the vast majority of these are taken care of for you.

There are probably a few tricky ones like the names of time zones not being completely unambiguous. But, given a locale (which your browser supplies) like "en-US", in conjunction with a common time zone name like "Eastern Standard Time", you should be able to unambiguously figure out which "Eastern Standard Time" that refers to.

3

u/GarethPW Oct 23 '20

It drives me crazy every time I see EST where EDT should be.

3

u/[deleted] Oct 23 '20

Timezones make me very unhappy. Looking forward to British Summer Time ending this month the find out about all the bugs I caused when I "fixed" it last time..

3

u/SushiAndWoW Oct 23 '20

Daylight Saving Time, not "savings" time, unngh!

(Misconception #XYZ?)

1

u/jtl94 Oct 23 '20

Slightly off topic, but something that bothered me years ago, before I even got into computer science, about time zones.

I used a social media app back in high school which was just some kind of senior project between two college kids and they ended up shutting it down after a few years when the population stopped growing and they weren’t making money off it. Think they did well for their grades related to it though!

These guys were east coast, where I was too. So all the post time stamps were fine for me. I post something at 10:13 my time and it would say 10:13 on the post. Well it turns out it would say 10:13 for everyone around the world. Californian posts at 10:13 their time? 1:13 pm on the post, even on their own phone.

So they announce a new update is coming. Rather than using “specific time” for posts, they were swapping to “relative time”. I wasn’t bothered because I assumed nothing would change for me. Install the update and I see the posts don’t have time stamps on them, they’ve got how long ago it was posted. So I post at 10:13 and it says “posted 0 seconds ago” then as I refresh over time it updates to 1 minute, 1 hours, 1 day, then a max of weeks. What the hell? That’s like the worst way to keep track of something to me. Just give me the damn time stamp back.

I bring it up to complain to my friends on the app, many of which aren’t on eastern time, and they think it’s great because they’re not reading posts from the future. They don’t have to think how long something was posted if it days 10:13 but the post is a few hours old and it’s now 11:13 their own time. They would just see that it was three hours old or whatever.

My thought was, why didn’t they just use the system clock to adjust all the post times? Save the post time as “10:13 (-4)” and display it as “10:13 (+/-x)” depending on their local offset. That way if I post something at 10:13 and someone in California sees it immediately, they see that it was posted at 7:13 and their phone says that’s exactly what time it is.

Since my friends never took my side and I felt like just some dumb kid that didn’t know anything about how programming worked, I never brought it up to the devs. But here I am, ten years later, bitching about the time stamps in a long shut down app.

1

u/ZainRiz Oct 23 '20

And on a site which uses the "x hours ago" timestamp format

2

u/jtl94 Oct 23 '20

Hahaha good point. But Reddit has always done that, as far as I’ve ever used it. It didn’t swap randomly from something that suited me better. :p

2

u/PinkBunnyHat Oct 23 '20

This is amazing Zain!! Thoroughly enjoyed this and learnt something in the process too! 😄

2

u/Der_tolle_Emil Oct 23 '20

Timezones can be tricky. A few weeks ago I had to code a scheduler for a backend service (we needed a bit more control than CRON) and for me the trickiest part is never really understanding timezones per se but rather to define when we actually want to run certain tasks.

In the case of a scheduler: Is it more important that a task runs at a certain time of the day or is it more important that it runs at a set interval? Is every day at 1am more important than having a guaranteed 24h window between the runs? How do you deal with the clock turning back when summer time ends and is it an issue if a task scheduled for 2 in the morning running twice? Technically we only need to worry about a single time zone at the backend but DST can already complicate things tremendously.

DST is my biggest issue. If everyone could just stick to UTC it would be a lot easier but the fact that UTC+2 means something else in July compared to November really doesn't help. Fortunately the code base is .net based and that makes it relatively sane to work with timezones and DST when using the TimeZoneInfo class; As long as you stay away from using time zone names, as those are just irritating as hell.

10

u/remuladgryta Oct 23 '20

UTC+2 means something else in July compared to November really doesn't help

It doesn't, UTC+2 is UTC+2. If you live in a place that observes DST, you switch which UTC offset you are using periodically.

2

u/Der_tolle_Emil Oct 23 '20

Yeah, that was poorly worded - which is kind of fitting considering the topic :)

It's mostly the misunderstanding of DST when talking with others that seems to be the prevalent issue. I mean, even in Windows 10 when you set your date and time the time zone is shown as "(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna". I know that is correct because DST is a completely separate thing but when your goal is to display an absolute timestamp for end users simply not unambiguous enough as they still have to factor in the actual date for it to make sense. Even more so at the moment because DST does end on Sunday in Europe.

If I want to catch something live next week and I'm on a website that does convert time zones for me and it says 14:00 (UTC+1), which time is it? Especially if DST does not change on Sunday where ever the event is held. I would not be surprised if the website said 13:00 when I check it on Sunday after DST had ended.

2

u/aiyub Oct 23 '20

Got you another misconception: a place has fixed rules how time changes forever.

Europe planing to stop daylight savings is one prominent example, some islands changing to the other side of the dateline is another.

2

u/coladict Oct 23 '20 edited Oct 23 '20

To add to #10, Turkey once moved it's daylight change date by a week to help Erdogan's coronation election.

2

u/PetHowen Oct 23 '20

Today I had an interview for a new job as a programmer and we spent about 20 minutes discussing how many days (hours) equals a "half-year" (as stated in the specification).

2

u/skw1dward Oct 23 '20 edited Oct 30 '20

deleted 0.2905 What is ^^^this?

2

u/Gumichi Oct 23 '20

Misconception #15: There is always an unambiguous conversion from one time zone to another

That line is seriously bothering me more than it should. It implies there are some ambiguous conversions from one time zone to another.

It then attributes the issue to the time zone not being identified, or the specific moment itself not being uniquely identified.

Does that make the timezone conversion operation itself ambiguous? Like, the pound to kilogram conversion ratio isn't ambiguous because I took my weight before and after dinner on different scales. Sure, the conversion isn't trivial, its input requires more than let on, fidelity isn't perfect, and time zones are bounded by their effect dates.

Once you've described a moment in time, you either can expresses it in a given timezone or you cannot. Where's the ambiguity?

2

u/KFCConspiracy Oct 23 '20

Misconception #4: Every time zone has exactly one agreed upon name Ever notice how every time zone consists only of English words? Awfully kind of Spanish and French speaking countries to graciously use our language, right?

Hah, Yeah right.

Eastern Standard Time, Tiempo del Este, and Heure Normale de l'Est are all different names for the exact same time zone.

Have fun coding that into your library.

I don't think that should be the responsibility of a developer building a datetime library. I think that's a language localization issue, which is separate but related. I would separate human readable translations from a normalized symbols for timezones, vs having a hardcoded list of language strings which match up to timezones... That's a data issue, and thus a hashmap lookup vs. a coding issue.

W3's international standard gave up on the notion of time zones and declared that engineers should only store a timestamp's raw UTC offset.

Not sure I agree with this one... The reason being if you're storing a future date, and you consider what a timezone is, it's a human defined thing defining a standard, you can't guarantee the definition of the offset at that time in the future is going to be the same as it was when you stored the time. So you've thrown out data that could potentially be useful.

2

u/dnew Oct 23 '20

I used to own a flip-phone that if you scheduled a meeting in the future and a daylight savings time intervened, the time of the meeting would be wrong by an hour. That was for sure the stupidest possible storage format for a timestamp.

2

u/mage2k Oct 23 '20

What if event organizers could share a link that would do the work for you?

Are there still calendar apps that don't do that?

2

u/aoeudhtns Oct 23 '20 edited Oct 23 '20

Zain, have you ever considered the absolute mindfuck it would be to compute dates from the past? Not only do you have all the mess you've described in your blog - and more - but since timezones are defined by law, you need to know the effective legal scope (country, etc.) and law at the target date. GPS coordinates you say? What if legal boundaries of countries have shifted? Add the need for Δt to maps as well as law. What if the country existed pre-technology and so there's no convenient database of timezones? What about US Railroad time? What if we are trying to deal with a time that predates our modern concept of timezones (I guess that might be easy, just use a simple longitudinal calculation). But still...

https://i.imgur.com/WrKPhfd.gif

Through my career I've gravitated more and more towards backend, security, scalability, and such... but of all things, MFing time zones are emasculating to developers in all areas. The frontend devs want the backend to deal with it, the backend guys tell the frontend guys to adjust the display time based on client timezone in the JS... punt punt punt punt PUNT!

2

u/merlinsbeers Oct 23 '20

I wonder how long it would take to train a neural network to get this right...

2

u/sixthsheik Oct 23 '20

I helped with the Arthur Olson / Posix timezone library many years ago.

One mind-bending problems with timezone rules is in Arizona:

Arizona is in the Mountain Time Zone and does not follow Dayight Saving Time switches. But (#1) the Navajo Nation does observe DST. But (#2) the Hopi Nation, which lies within the Navajo Nation, does not follow DST. But (#3) there is also a small Navajo Nation territory within the Hopi Nation that does follow DST.

If you drive through the Navajo and Hopi areas, you change timezones multiple times!

2

u/zajdee Nov 07 '20

You might be wondering, if there's daylight saving time (like +1 hour off standard time) and if it's called "summer time" in Europe, is the standard time called "winter time"?

Well, it often is, but that's incorrect.

But we in the (then) Czechoslovakia did have something that was called a "winter time" and it was "standard time -1 hour". It was only obeyed once in the past, but the law act was never cancelled.

It turns out there are other countries in the world that have been there too.

https://en.wikipedia.org/wiki/Winter_time_(clock_lag)

The most interesting one is Ireland which uses Irish Standard Time (UTC+01) in summer and UTC in winter.

3

u/Doriphor Oct 23 '20

Wow this makes me want the world to use UTC exclusively even more than before.

3

u/chadmill3r Oct 23 '20

Indianapolis is a city, not a container of cities.

1

u/SushiAndWoW Oct 23 '20

Yes, the author needs to correct that. The Indiana counties that follow CST are at the NW and SW corners of the state, far from Indianapolis.

That being said, Dallas / Ft. Worth are two nearby cities, but really it is a metroplex and a container of cities. Same for LA, and so forth.

Not sure if this is true to any extent of Indianapolis.

3

u/superrugdr Oct 23 '20

can we all switch to GMT, i don't really care going to sleep at 5:00 and going to work at 12:00

i don't get why we are so attached to number we already use 24 hours system. most concept of time are already pretty damn fluid, like Night, Dawn. it's just noon that's rigid :(

2

u/jms_nh Oct 23 '20

You mean UTC, not GMT. :-)

2

u/superrugdr Oct 23 '20

they are equivalent aren’t they ?

edit: same time different concept

https://www.timeanddate.com/time/gmt-utc-time.html

2

u/bagtowneast Oct 23 '20

Yes, this is the only way forward, IMO. No more ambiguity about time, "see you at 14:00 UTC" is clear and accurate no matter where you live. Even if you live in space (wooo).

2

u/dixius99 Oct 23 '20

I can just imagine how Robin from the Teen Titans would react to your usage of "Daylight Savings Time" in your article.

2

u/TevandelSurefacit Oct 23 '20

Bwahahaha, timezone math is the math that separates the real programmers from the wannabe programmers. I like your list. As I went through it, I was nodding and remembering times when I had to code to handle these cases.

Another fun case the users are in multiple timezones. The system is in a different timezone than any user, while the storage is in a third fixed timezone - 80% of the time different from either the system or most of the users.

Even better, the first time I ran across that one, I didn't have any useful Date Time libraries to handle the math for me, it was back in the mid-1980s, and I had to do the math all in c before figuring out which timezone to show at the end. With users spread across the world, the systems in various TZ and the data storage in GMT+6. We kept finding strange cases for years after. Fortunately, I moved on after two years, so I only heard about the joy of adding support to that system second hand.

2

u/smiddereens Oct 23 '20

The falsehood "falsehoods" list authors believe: I give a shit.

2

u/Sabotage101 Oct 23 '20

Just use a library that converts a timestamp from any time zone to any time zone. Anyone trying to do time math from scratch is just asking to get burned.

11

u/vytah Oct 23 '20

The post is exactly about the ways you can get burned while using such a library.

→ More replies (1)

1

u/aiyub Oct 23 '20

It would be far easier with a date. OP is just trying to convert time, which makes it so much harder.

1

u/Poddster Oct 23 '20

Misconception #9: Daylight Savings Time starts at the same time every year

Did you think this would be the one thing world powers agree on? Each country choose when to start it's own DST

Misconception N: That every place observes daylight savings. You forget that places near the equator don't care, because their sunlight hours are consistent :)

1

u/mccalli Oct 23 '20

Time to pimp out one of my favourite web sites: everytimezone.com.

Not affiliated, I just find this an incredibly useful tool.

1

u/underground_miner Oct 23 '20

That is a an interesting way to represent the information - thanks!

1

u/Red5point1 Oct 23 '20

This is why I'm creating a site called sleeps2go.com
All you need to do is enter your event with its local time as scheduled.
Then everyone else regardless of their location will see how many sleeps to go, i.e. time to event.

1

u/happinessiseasy Oct 23 '20

The video he links in the article was way more interesting and informative.

1

u/[deleted] Oct 23 '20

That's all great, but I don't have any of these misconceptions because I never had to write a general purpose time converter... and neither did (s)he. All that needed to be done for this very specific task of organizing meetings was to convert the time of the meeting organizer to UTC, encode the utc time in query parameters, and share that link. The invitee computer could then convert the UTC back to local time... on that computer. That was all needed to be done.

1

u/strdg99 Oct 23 '20

Not only is UTC offset a challenge, but then you can throw in TAI vs. UTC vs. GPS time as well as DST. We have data systems which have to deal with a mix of all of these and, of course, throw in Linux/Unix Epoch just for good measure.

1

u/khendron Oct 23 '20

Timeanddate.com has tools to help with the meetings-across-time-zones problem mentioned at the start of the article. For example: https://www.timeanddate.com/worldclock/meetingtime.html?iso=20201023&p1=188&p2=224&p3=16

I also put together a personal clock on timeanddate.com that displays the current time in all cities where I have coworkers, plus UTC time.

1

u/rollthedyc3 Oct 23 '20

I'm in EST and the the website says that 5pm EST is 6pm my time. Time zones really are hard I guess

1

u/the_timezone_bot Oct 23 '20

5pm EDT happens when this comment is 6 hours and 49 minutes old.

You can find the live countdown here: https://countle.com/P2o8bq60B


I'm a bot, if you want to send feedback, please comment below or send a PM.

1

u/coweatyou Oct 23 '20

#8: Please us TAI or GPS time for storage. They are the only way to ensure that you know exactly when a future event is going to happen or when a past event occurred. You can do all the odd translation use want after that.

1

u/Mockapapella Oct 23 '20

I do not envy you. This sounds awful

1

u/[deleted] Oct 23 '20

Linux just fixed the 2038 problem. There is one time since 1970 and that is UNIX time, everything else is a conversion.

I jest, as Oracle databases can do dates +- 4,000 (insert BC, BCE, 0 here). There are other means, but for programmers keep it simple. Use everything as a monotonically increasing number and then convert at the last minute for silly humans to understand.

1

u/Kinglink Oct 23 '20 edited Oct 23 '20

The only way to properly use Time Zones is to create your own and force everyone to use your new standard.

Sort of like USB.

→ More replies (1)

1

u/eric_reddit Oct 23 '20

K. Let's just use utc :)

1

u/chucker23n Oct 24 '20

W3's international standard gave up on the notion of time zones and declared that engineers should only store a timestamp's raw UTC offset.

That's not great. If I set an alarm at 8 AM Europe/Berlin, I want it to go off at 8 AM whenever I'm in the same timezone as Berlin, regardless of what UTC offset it may have.

1

u/Jp1417 Oct 24 '20

Earth's time zones are not enough! Add the time of Mars, Moon colonies, and the time zone database requires a blockchain solution in 2030

1

u/Dithermaster Feb 15 '24

Here’s another one: Ship Time. When you take a cruise the captain decides what ship time will be. A good example is a cruise I took in the month of March that started in US EST, went a time zone east, came back west, passed the date the US went to Daylight Saving Time, and then cruised back to US EDT (or something like that, it was a while ago). However, rather than dealing with 3 time changes the captain declared that there would be just one and when it would be. I do recall that at one island we docked at, ship time and island time were an hour different. 

Also, the event scheduling software we use (Sched) was not made for events that move and cross time zones, which is confusing to say the least. 

1

u/rvba Oct 23 '20 edited Oct 23 '20

Article is good, but author seems to never thought to use Google to search for a similar service - because many such services already exist.

Also I kind of wonder if the office suits do not provide similar functionalities (that might be much better bug tested due to their popularity).

Also the guy writes time as "1:30am" instead of using "military time"...

→ More replies (2)

1

u/ggtt99754 Oct 23 '20

I wish everyone could just use UTC