[tz] Fwd: tzcode: system-dependent default time zone file

Paul Eggert eggert at cs.ucla.edu
Thu Jul 7 07:34:31 UTC 2016

-------- Forwarded Message --------
Subject: 	tzcode: system-dependent default time zone file
Date: 	Wed, 06 Jul 2016 21:11:19 -0400
From: 	Steve Summit <scs at eskimo.com>
To: 	Paul Eggert <eggert at cs.ucla.edu>

[Belated reply to an earlier thread.  Feel free to post this to
the tz list, or not, your choice.  Other than Guy Harris, I don't
know how interested the rest of the list is in these lower-level
coding and build details.]

Back in January, in the "tzcode test suite" thread, Paul and I
had this exchange:

>> I'm not sure what that warning about "no nontrivial tz offset tested"
>> means, but I hope we can fix the testsuite to set TZ itself if that's
>> what it needs to do.
> Setting TZ is what I needed to do, although I'm surprised that you
> had the same problem, so this will bear further investigation.

I believe the problem is simply some variation across systems in
the location of the tz file that sets a machine's local time zone
in the absence of a TZ environment variable.  As compiled out of
the box, tzcode expects to find this in TZDIR/localtime, that is,
in /usr/share/zoneinfo/localtime.  But on my Mac it's /etc/localtime,
and I suspect it's probably there on Paul's Fedora machine, too.

The fix is simple: I'm now setting

	TZDEFAULT = "/etc/localtime"

in the Makefile, and then passing it down to the compilations:


With these changes, I no longer need to explicitly set TZ to keep
tzcode's copy of localtime happy.

I was going to propose adding this comment to the Makefile in the
tz distribution:

	# By default, the local time zone is taken from the file
	# "localtime" in TZDIR.  Or you can set TZDEFAULT to something
	# else (for example, it's typically "/etc/localtime" for MacOS,
	# BSD, and some versions of Linux).

But I believe TZDEFAULT in the same Makefile is also used when
*installing* a set of zoneinfo files built from tzdata, and I'm
uncertain of the repercussions for tzdata builds if I encourage
people to tinker with TZDEFAULT to match their OS.

This is probably a symptom of a deeper issue: if someone
downloads and builds tzdata and/or tzcode, is it assumed that
they'll be installing and referencing the zoneinfo files in the
tzdata/tzcode default location, or in their OS's preferred
location, or what?  And the answer gets more complicated
depending on whether people are actually using tzcode, or their
OS's possibly different tz code -- glibc or whatever -- instead.

More information about the tz mailing list