[tz] Recommendations for stable list of timezone ids

Robert Elz kre at munnari.OZ.AU
Fri Feb 9 13:44:02 UTC 2018


    Date:        Fri, 9 Feb 2018 13:44:03 +0100
    From:        Tobias Lindaaker <thobes at gmail.com>
    Message-ID:  <668D7370-5E19-4ECA-BBE5-D6C6FF6EB318 at gmail.com>

  | I am trying to compile a flat list of all tzids in the Time Zone Database in a way such that the 
  | position of a tzid remains the same in the list even in the face of future changes to the
  | Time Zone Database.

There is nothing like that at the minute, but there's no reason that one 
couldn't be added if it would really be useful.   That is no reason other
that that there are people here who would complain about the format
being changed...    You'd need to start from some future tzdb version
of course (2018d or later - if it were added.)

  | Finally some background on why (I think) I need to generate this type of list of tzids: 
  | I am improving the support for storing timestamp values in a database management system
  | (Neo4j), and would like to avoid having to store the timezone component of zoned timestamps
  | as a (variable length) text component, but rather store it as a fixed size integer offset into a
  | table of tzids. Thus I need such a stable list of tzids.

Couldn't you just create a new table with a mapping from the current keys 
(America/New_York) to an integer (or short string).  Then do a one time startup
lookup to extract the short id corresponding to a zone .. if that lookup fails, then 
simply create a new entry in the table with the next available id (one just 
bigger that the biggest currently in the table) and from that time forever 
after that zone name -> id mapping would be stable.

No need for new distributions, the software simply takes care of itself.

It would mean that the short id would be local to a particuar installation
(not something that could be exported - but you can just lookup the id in
the new table, and map it back to the longer (common) name for export to
some other site)

kre



More information about the tz mailing list