[tz] version information in tz binary file?

Alan Barrett apb at cequrux.com
Tue Sep 10 14:30:38 UTC 2013

On Tue, 10 Sep 2013, Zefram wrote:
>Paul Eggert wrote:
>>+Also, for version-3-format time zone files, the version-2 header and
>>+data are optionally followed by a section containing auxiliary
>Version-1 and version-2 tzfile formats have the somewhat-useful feature
>of being self-delimiting: you can read up to the end of the tzfile and
>no further without requiring lookahead.  It would be wise for version 3
>to retain this feature.  So the aux-data section shouldn't be optional,
>and should have an explicit terminator.

I agree, and I'd also suggest an explict length, so that readers 
who want to skip over this information can know how much to skip, 
without needing to parse it all.

It might also be useful to provide some guarantees of forward 
compatibility.  For example, one could state that future 
extensions to the format may insert additional information between 
the new keyword=value list and the new second copy of the POSIX 
TZ string, but will retain the following overall structure for as 
long as possible, until a major change in format is required:

     32-bit version of transition data;
     64-bit version of transition data [for tzh_version >= '2'];
     POSIX TZ string [for tzh_version >= '2'];
     list of keyword=value pairs [for tzh_version >= '3'];
     [new data for tzh_version >= '4' may appear here];
     second copy of POSIX TZ string [for tzh_version >= '3',
             guaranteed to be at the end of the file unless
             there is a major change to the format];

Now is the time to tell implementors: you may look for the 
newline-delimited POSIX TZ string either just after the 64-bit 
version of the transition data, or at the very end of the file, 
but don't look for it just after the keyword=value list, because 
tzh_version >= '4' will probably put something else there.

--apb (Alan Barrett)

More information about the tz mailing list