FW: Time zone equality?

Garrett Wollman wollman at lcs.mit.edu
Fri Jun 21 17:29:09 UTC 2002


<<On Fri, 21 Jun 2002 11:20:46 -0400, "Olson, Arthur David (NCI)"
<olsona at dc37a.nci.nih.gov> said:

> Help! Can someone explain the algorithm for TimeZone::operator==? That is,
> how do you know if two time zones are the same or different?
 
If two time zone data files are linked together (or one is listed as a
Link for the other in the source files), then they are the same time
zone; otherwise not.  This is of course using the definitions of the
time zone database project.  Because the database includes the
complete history of civil time (or as close as we can come to it) for
at least one location in every country, there are many more time zones
(by this definition) than there are regions which currently observe
the same civil time.

Depending on your need to process retrospective data, you can process
the time zone data to exclude transitions before a specific date, and
then compare the remaining transitions to achieve a less-strict notion
of equality.  For example, if your cutoff date is 2002-01-01 (perhaps
you're only interested in future dates), then America/New_York is the
same as America/Kentucky/Louisville, America/Kentucky/Monticello,
America/Detroit, America/Montreal, America/Thunder_Bay,
America/Pangnirtung, America/Iqaluit, and America/Nassau.  This list
includes locations which have changed time regulations as recently as
2001!  There are in addition about a dozen places which I have not
listed here which observe UTC-05:00 year-round and thus belong to a
different zone.

> Trouble is, this list is huge and bewildering, with a great deal of apparent
> redundancy. For example, there are 37 different time zones listed at
> GMT-04:00.

For any one country, there are not nearly so many choices.  If you
require your users to select a country first, then you can narrow down
the list of time zones substantially.

> We want to generate a shorter list, but we're also reluctant to just throw
> out legitimate choices. If two time zones are equivalent, then it's OK to
> drop one from the list. But how can you tell? How does Windows do it?
 
Windows doesn't do it.  Windows does not concern itself with
timestamps older than Windows itself is.

-GAWollman



More information about the tz mailing list