[tz] [PROPOSED PATCH 8/9] Add NetBSD-inspired functions for timezone_t objects.

Alan Barrett apb at cequrux.com
Tue Aug 26 19:07:34 UTC 2014

On Tue, 26 Aug 2014, lennox at cs.columbia.edu wrote:
>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.)

NetBSD-6.x did not define what a NULL argument to tzalloc meant,
but NetBSD-current defines it to mean UTC.  NetBSD-7 is not yet released,
so if we want to change that, now would be a good time to do so,
before the "NULL means UTC" behaviour appears in any release.  I like
your suggestion of letting NULL refer to the system's default timezone,
and "" refer to UTC.

>I'd also suggest that tzalloc should fail for unknown time zone names,
>rather than silently returning GMT.

In NetBSD, it returns NULL for error.  At least, that's the intent.

>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.

Thanks.  I had forgotten that proposal.

--apb (Alan Barrett)

More information about the tz mailing list