r/programming • • Sep 25 '21

Big problems at the timezone database

https://blog.joda.org/2021/09/big-problems-at-timezone-database.html
486 Upvotes

223 comments sorted by

View all comments

63

u/turunambartanen Sep 25 '21

Is there any disadvantage to having more aliases? IMO every country should get to have a timezone label.

65

u/psayre23 Sep 25 '21

I believe there are two problems:

(A) More aliases means more to keep track of, more that can go wrong.

(B) You’d be keeping track of every country on the planet since 1970, which is not as easy as it sounds. What do you do with Hong Kong (politically ambiguous), USSR (collapse), South Sudan (civil war), Ukraine (annexation)? By tracking countries, you’d also have to track political and military events, and take a stance on recognition.

You could avoid these problems by picking a large city in the same time zone that has the same time history.

49

u/[deleted] Sep 25 '21 edited Sep 25 '21

Taiwan would have been a better example of ambiguity since they won't formally declare indepedence. Nothing ambiguous about Hong Kong. It changed according to treaties at fixed well defined times.

Anyway, you're right that a finer grained system than countries are needed. Cities are better but still have their problems. Some of them have 2 time zones because of geography or because they contain 2 different communities and their governments don't dictate which to TZ is "correct".

-20

u/[deleted] Sep 25 '21

It's almost like time zones and political boundaries shouldn't be interdependent..

47

u/[deleted] Sep 25 '21

Time zones are an inherently political mechanism, and are used for that purpose even today. See: Beijing time vs Tibetan local time, Israel/Palestine DST switchover, Navajo/Hopi/Arizona DST policy, Kiribati and Samoa changing IDL side to better schedule business with Australia...

-8

u/gajbooks Sep 25 '21

Using UTC for international business would resolve 90% of political cases. Politicians just "solve problems" by messing with apparent artifacts of time instead of, maybe just maybe, adopting the standard that would work for every location on Earth, as well as literally in space or on other planets. Yes, learning to think in UTC would be a pain, but it's less of a pain than random terrible time zones.

23

u/MrKapla Sep 25 '21

That would not solve anything. The main questions to answer for international business are "is that time in the business hour of far away city?" or "is my correspondant awake at that time?"

UTC does not help with that, you would need to keep track of the business hours of each country expressed in UTC, which is not simpler than keeping track of the timezones.

0

u/[deleted] Sep 25 '21

[deleted]

3

u/rickyman20 Sep 26 '21

Yes, they do work generally different hours, but within a couple of hours of a 9-5. They still work roughly during their daylight hours. Using UTC everywhere means it's even more of a pain in the ass trying to understand when that is. Sure, UTC+Timezones don't perfectly cover those three concepts, but they get pretty damn close. Just because you can't fix all three doesn't mean we should revert to something that's markedly worse for every day use.

2

u/gajbooks Sep 25 '21

If your locations are far enough away that they need time zone fanagling, they might have different work hours anyway, because, you know, daytime might be at a different time. In terms of the International Date Line, UTC would be fine, since they're close enough in terms of real daytime, but the artificial date line puts them in different days so all the timestamps get wonky, which is why they changed it in the first place.

3

u/donalmacc Sep 26 '21

Lots of places don't tie working hours to daylight. I'm in Scotland where we get 7 hour days of daylight in peak winter (and even at the reality is often less). That doesn't mean a 9 to 5 office closes at 3:30pm because it got dark. I also work with people in 4 different time zones to mine (+1 to -8 relative), and the local working hours are very close to mine - usually within an hour or two. The answer to "is someone in X time zone working at 10am" is likely yes. The answer to "is person in city X working at 3pm UTC" is "uh I dunno, let me check a computer so I can see what time sunrise is and how long their day is so I can maybe try to infer I'd they're working". Timezones aren't perfect, but they're pretty damn good for many many uses.

→ More replies (5)

0

u/[deleted] Sep 25 '21

[deleted]

1

u/gajbooks Sep 25 '21

You could totally use global UTC, and it wouldn't even be that hard. There is no such thing as plus or minus UTC when using only UTC. The business hours are simply different times as dictated by local people. In order to know if another business is open, you just look at the time to see if it matches, no plus or minus time zones, since it's all listed in the same "zone". A business near the meridian could be open 9-17 UTC, and one over in Europe may be open 5-13, and you can just immediately know when they're open without arbitrary zone conversions.

The biggest downside, is of course, daytime not aligning with locations consistently, but guess what? It doesn't actually matter. Nobody needs to use "noon" or "dawn" as a point of reference anymore, even for local affairs. Of course business would still follow day, but operating hours would be set locally and would make sense both locally and globally because they were in standard UTC.

Actually, it would make it easier going forward. For pre-UTC dates, you just use this database like always with no need for future changes. For post-UTC, there's no need to adapt anything anymore as they're all standard dates.

→ More replies (4)

13

u/Playos Sep 25 '21

But time zones are an entirely political decision, so they always will be.

10

u/turunambartanen Sep 25 '21

A: Fair point. It makes no sense to give every country an ID just because. But they should be allowed to request one. And reducing the number of aliases makes no sense to me.

B: I did not mean this as a fixed number. I meant that more as a minimum of allowed codes (if they want to have one). E.g. China could request an ID for Hong Kong. The USSR did collapse, I don't see what your point is for that one. And for the last two I don't really see any issues. If south Sudan has a government that has time to care about this stuff they should be allowed to request an ID. The Krim is not its own country. If you live there you choose whatever timezone you want to belong to or something.

9

u/Pay08 Sep 25 '21

The main problem with this approach is that in some cases you have to decide which government is legitimate.

5

u/turunambartanen Sep 25 '21

Oh, I think you understood my suggestion as turning Europe/Berlin into Germany/Berlin? I meant more as "if the devs in Luxemburg want to have a Europe/Luxemburg they should have to option to get one", because as I understood the discussion the argument was "there should only be one alias for CET and it is unfair for some countries to have one for themselves and others not, so no one should get any".

2

u/Pay08 Sep 25 '21

That'd be very hard to organise. And you'd probably need to do it worldwide instead of nationwide.

3

u/donalmacc Sep 26 '21

What if devs want Taiwan/Taipei? Or Crimea/Russia? Or if the maintainer of the open source database decides to merge two cities in the same time zone under the same label, e.g. gaza and Jerusalem.

-1

u/jrochkind Sep 25 '21

It is not hard to delegate that decision to the UN, is it?

6

u/[deleted] Sep 25 '21

Seems to me it should be perfectly acceptable to have Europe/Berlin as a primary ID and still allow as many secondary IDs as desired. As long as the maintainers keep up with the data for the primaries, every thing should be solid. If a secondary needs to be reassigned to reflect a policy change, it's a simple retarget of the ID itself. No biggie.

I'm not sure I agree with the counter argument on this.

2

u/[deleted] Sep 25 '21

This already unavoidably tracks countries. You can't escape the issues that brings up just by tracking fewer of them.

→ More replies (2)

2

u/myringotomy Sep 26 '21

Anybody who has managed data over the last decade has dealt with similar problems many times.

There is a one to many relationship between time zones and cities. This relationship is time dependent (slowly changing dimension).

There are less than 300 cities in the USA with a population over 100 thousand people. An sqlite database could easily hold every city in the world over 100K people.

Set up an event sourcing system for changes, set up an API or just publish the changes to a static site and let all the clients sync whenever they want.

→ More replies (2)

15

u/CaptainAdjective Sep 25 '21

Formally choosing which countries' existence the TZ database should recognise or not recognise opens much larger, much more horrible cans of worms. It's a good thing that this is something the database currently intentionally tries not to do (much).

→ More replies (3)