[tz] Converting cities to tz identifiers (tangent)
Clive D.W. Feather
clive at davros.org
Tue Feb 20 17:59:28 UTC 2018
John Hawkinson said:
> * I was expecting theory.html to give me a little more guidance on the "right" way to do this. As best as I can tell, the "right" (no pun intended) answer is that I should geolocate each city to longitude/latitude (using some unspecified resource, which seems fine), then use one of the datasets or tools at https://data.iana.org/time-zones/tz-link.html#boundaries to convert those locations to zones. This seemed a bit much.
Unfortunately reality can be like that.
> * I was also a little surprised to not find someone with a handy list of United States states and territory mappings to tz identifiers (for those cases where the state/territory/district uniquely mapped to a tzid). Other than the comments in "northamerica" (which are not quite as structured as one might like, but are pretty good).
I don't know enough about US time history to be able to comment.
> * Then I was faced with the question of what the most stable identifier to use was. For instance, take Boston, Massachusetts. I could record it as America/New_York, or as US/Eastern. For instance, at some point in the future, either Boston or New York might exit the Eastern time zone. Cases:
> Case 1: If that New York exited and Boston didn't, picking US/Eastern would clearly be the more stable choice.
The correct answer is that if New York and Boston ever do different things,
no matter what they are, then the existing America/New_York will be forked
into two (or more) zones. New York will stay in that one. I can't say what
the other one(s) will be, because it will depend on the details of the
change. It might be America/Boston but might not.
> Did I miss an obvious way to address this more simply?
> Is it horrible to have made use of third party websites that lack any sort of auditable authority but are probably correct anyhow.
Is there an official source for which parts of the US are *currently* in
which time zones (including different summer time transitions)? If there
isn't, then you can see the problem. If there is, then is there such a
source for every date from 1970 onwards? If so, then that could be
converted to form what you want. If not, then you can see the problem.
Of course, that doesn't address places that de facto use a different time
to the de jure one. Eucla in Australia is the obvious example: legally it's
on UTC+8 the whole year round, but in practice it's UTC+8:45 and the TZ
database recognizes that.
> Does someone (Paul?) want to convince me that it's Wrong to use the "backward" zones, for the narrow (but common) case of United States of America cities?
I'm not sure what the point of them is, so I can't comment.
Clive D.W. Feather | If you lie to the compiler,
Email: clive at davros.org | it will get its revenge.
Web: http://www.davros.org | - Henry Spencer
Mobile: +44 7973 377646
More information about the tz