On Sunday, August 24 2014, "Paul Eggert" wrote to "tz@iana.org" saying:
(tzalloc, tzfree) [NETBSD_INSPIRED]: New functions.
These functions aren't documented yet, as far as I can tell? So I'm uncertain about their exact intended semantics. But it seems there's no way to get a timezone_t corresponding to the system wall clock time zone, i.e. the one that would be used by the non _z versions of the functions? If the TZ environment variable is set, tzalloc(getenv("TZ")) returns the correct time zone, but if it isn't, you get GMT not localtime. (I suppose you could do readlink("/etc/localtime") in that case, but that's error-prone and not very portable.) Since NetBSD doesn't define what a NULL argument to tzalloc does, could I suggest that it indeed mean /etc/localtime? That way, tzalloc(getenv("TZ")) always does the right thing. (UTC can be obtained by passing "" to tzalloc, just as you can for the TZ variable.) I'd also suggest that tzalloc should fail for unknown time zone names, rather than silently returning GMT. This was the defined behavior of the similar proposal I made on (the predecessor of) this list back in 2001: <http://mm.icann.org/pipermail/tz/2001-June/011692.html>. It might be worth reading over some of the other discussion there as well. -- Jonathan Lennox lennox@cs.columbia.edu