[conspire] "Time zones exist to make programmers' lives miserable" ...
Rick Moen
rick at linuxmafia.com
Tue Feb 16 10:35:13 PST 2021
Quoting Fred Brockman (fbrock at att.net):
> Is there such a thing as simple generic time zones, i.e., from GMT
> there are 24 zones incrementing by an hour each time going around
> the world? Do these zones have generic names?
Really good question. I like that question, because it goes straight to
the heart of this problem area, and to _why_ it's a problem. And it was
even more astute of you to mention the distinction I drew between
America/Toronto and America/New_York, because there's a point I hinted
at, there, too, and now I can revisit that point and make it clearer.
Answer: Yes, generic names do exist / there are generic time zones.
But the ones that are simple/generic tend to be ambiguous as to
reference in _some_ cases, and in almost all cases the DST seasonal
changes make them undesirable to use in timezone offset operations
between two distant places on the globe.
(1) Ambiguity problem: All of India plus Sri Lanka is on Indian Standard
Time, 5:30 hours ahead of UTC. "IST" is a valid abbreviation for that
timezone. So, should you use the abbreviation "IST"? Probably not,
because "IST" can instead/also mean Irish Standard Time (1 hour ahead of
UTC) or Israel Standard Time (2 hours ahead of UTC).
I'm pretty sure you can use "IST" in date(1) timezone references, and
I'm sure it's parsed to mean one of the three things that can stand
for -- but I'm not going to even test to find out which one, because
it's just obviously not the right thing to use.
(2) There are 24 time zones, right? Spoiler alert: No. Scientists
would divide the world like an orange into 15 degree timezone slices,
each successive one at 1 hour intervals, and life would be simple. UTC
at Greenwich at the Prime Meridian, but go west 15 degrees and you're at
UTC-1, which could be given a handy name like Iceland Time, and Bob's
your uncle, we're done, all sorted.
Alas, the world isn't run by scientists. Countries are a thing, as one
complication. I already mentioned that all of India is decreed by the
New Delhi government to be set to Indian Standard Time, fixed at UTC+5
1/2. India doesn't do summer daylight saving changes, being close
enough to the equator to not need that (like Hawaii). And you might
think, as a scientist would think, that Almaty, Kazakhstan, being
directly north of India, would be on Indian Standard Time, too, even if
it's under a different name for reasons of local pride. But no, it's
not. It's on Alma-Ata Time (ALMT), UTC+6. Because Kazakhstan is a
sovereign country, and countries decide things individually.
(Kazakhstan is big enough that the western part of it is in a
_different_ time zone, UTC+5, which goes under two different names,
Aqtobe Time = AQTT and Oral Time = ORAT, named for two cities. And the
dividing line between the two time zones does _not_ go straight
north/south by a long stretch, but rather is jagged and zig-zags to
follow natural terrain divisions.)
So, how many local times ("timezones", ignoring multiple names some go
under) are currently in use in the world? 38.
That includes some really weird ones, like a number with 15 minute
offsets, like:
o Nepal is UTC+5:45, called Nepal Time (NPT)
o New Zealand's Chatham Islands are UTC+13:45, called Chatham Island
Daylight Time (CHADT), except when they're on UTC+12:45, called
Chatham Island Standard Time (CHAST)
(3) Daylight saving time screws everything up further. Take a simple
thing like: Imagine we're not in the middle of a pandemic, and you want
to hop on a nice little Hawaiian Airlines flight to Honolulu. Hawaii's,
er, what, two 15 degree one-hour timezone widths west of Pacific Time,
right? You eyeball the distance on the map, and that looks about right.
There's that 15 degree stretch of longitudes west of the Golden Gate
that has a whole lot of ocean, and looks like it might sweep north to
Juneau (plus part of BC, and then the next 15 degree slice of the earth
that includes Hawaii -- a long flight, but not as long as going to the
East Coast. So, you think, logically that's two hours earlier than
Pacific Time, right?
Ah, not so simple, Grasshopper. There is no "Pacific Time", really.
That is samsara, illusion. "Pacific Time" refers to the two evil twins,
Pacific Standard Time (UTC-8) and Pacific Daylight Time (UTC-7), that
come and go from these shores based on the calendar. Meanwhile, Hawaii,
being tropical, eschews daylight saving time changes. It's on Hawaii
Standard Time (HST), which is UTC-10. So, in short, Hawaii is two
hours behind us, except sometimes it's three.
I should throw in here that descriptor "PST8PDT" is a valid timezone
name for our evil twins (Pacific Time).
https://en.wikipedia.org/wiki/List_of_tz_database_time_zones calls that
name deprecated, and advises "Choose a zone that observes PST with
United States daylight saving time rules, such as America/Los_Angeles."
I'll be damned if I know exactly why.
(3a) Daylight saving time itself can be weird. You might think that
daylight saving time is a seasonal one-hour offset. Yes -- except one
oddball place on the planet. There just _had_ to be an exception,
right? New Zealand's Lord Howe Island switches between Lord Howe
Standard Time and Lord Howe Daylight Time using a _half_ hour offset.
Not one hour. Because nothing about timezones can be simple.
(4) Timezones that are aligned between countries _could_ become
disaligned, so some caution might be worthwhile.
You called attention to my cautiously specifying TZ=America/Toronto
for the Kitchener-Waterloo Linux User Group in Ontario, _even_ though
TZ="America/New_York" would also work on a pragmatical level. Why?
The reason I cited was respect for our Canadian cousins, showing good
manners in recognising Canadian sovereignty. But there's also an
operational reason, although it's not a problem at the moment and
probably will never be: Ontario's provincial and national government
decrees that Ontario will follow the same time zone practices, including
the dates of switch between standard and daylight time, as the US East
Coast states south of it -- but theoretically that could change.
The US East Coast's time practices are governed by US law and Ontario's
by Canadian law. Those rules will _probably_ never differ, but they
could. Point is, if that happens, Unix systems' TZ database files
will get tweaked to account for Yet Another Country Messing with TZs,
and "TZ=America/Toronto" will continue to give the correct time offset
for Kitchener-Waterloo Linux User Group, automatically.
> Just thinking a generic name would give you a vague clue about which
> temporal ballpark you're in for those of us *not* trying to be there
> promptly at 5:00 PM.
I'm with you. Locally, "Pacific Time" is a human-friendly expression
and we know exactly what it means including the fact that it implies
a seasonal clock change controlled by US law. Although I'd feel a
little sheepish using that term in front of an Aussie or New Zealander
or even a Hawaiian -- like, their time is somehow less Pacific? --
nonetheless a Brit, say, would know what the reference was, especially
when the term is pronounced using an American accent. But date(1)
cannot process that name. date(1) _can_ process PST8PDT, which is a
mouthful but unambiguous, yet is deprecated.
Anyway, that's what I know -- and I tried to follow best practices in my
additions to https://www.wiki.balug.org/wiki/doku.php?id=balug:covid-19,
even where I am not 100% clear on reasons, e.g., with "PST8PDT".
More information about the conspire
mailing list