[tz] FW: Beginner's help request

Zefram zefram at fysh.org
Wed Nov 22 10:30:28 UTC 2017


Daniel Ford wrote:
>                                 Zic produces binary data that looks like it
>will be of little use to me (since I don't know what it is!),

That's the binary tzfile format, documented in tzfile.5{,.txt}.  It is
an excellent format for your purposes.

>                                                                  zdump
>produces a potentially useful ASCII output.

The best way to use zdump is to compare its output against the output
of your own code, to make sure you're parsing tzfiles correctly.

>into Makefile and extracted the line that specifies the source files
>(PRIMARY_YDATA=

That's not the full set of data files, though it might be a subset that
you want to work with, because it covers the distinct geographical zones.
The full canonical set of zones, including non-geographical zones and
links, comes from the files specified by TDATA.

>                                             I presume this set of files is
>unlikely to change in the foreseeable future?

In practice it changes very slowly.  There are no guarantees, though.
Nor are there guarantees about most of the Makefile macro names.

>But zdump produces DST output in 'absolute date' form rather than the
>'current rules' I'm looking for.

It's unrealistic to expect rules.  Quite often there is no set of
rules that will apply correctly to each of the next few years, because
rule changes have been scheduled.  In the general case you *must* cope
with having different rules for different years, in the ultimate case
separate rules for each year, so it should be no hardship to *always*
handle upcoming behaviour in the form of explicit transitions.

The binary tzfile usually provides a ruleset applicable to indefinitely
many years, in the form of a POSIX TZ string.  But that's not the current
rules, it's the rules to be applied when all of the file's explicit
transitions have run out.

-zefram


More information about the tz mailing list