[ntp:questions] Kind of OT : GMT timezones in linux

Per Hedeland per at hedeland.org
Sun Jul 8 10:55:36 UTC 2007


[ The quoted message was posted to the mailing list
  but never appeared in the newsgroup. ]

James Cloos <cloos at jhcloos.com> writes:

>>>>>> "Per" == Per Hedeland <per at hedeland.org> writes:
>
>Per> And besides the invaluable geographical-region-based zone files, it
>Per> comes with a directory full of GMT+/-N files - but using them gives a
>Per> different result:
>
>Per> $ env TZ=Etc/GMT-2 date
>Per> Wed Jun 27 21:49:52 GMT-2 2007
>
>Technically speaking, the TZ variable requires a leading colon when
>specifying a file.  So the above example has to be:
>
>:; env TZ=:Etc/GMT-2 date
>Sat Jul  7 06:29:14 GMT-2 2007

Interesting, I wasn't aware of that syntax - however the "requires"
part seems doubtful.

>Many libs try looking for a file even without the leading colon, but
>that is not part of the standard.

Um, what standard would that be? A reference would be appreciated (and
ideally a quote if it isn't available online).

>Cf: tzset(3), such as at:
>
>http://ccrma.stanford.edu/planetccrma/man/man3/tzset.3.html

Well, that is a Linux man page, and as such of limited information
value. As is often the case, it is not correct even for Linux itself -
its relevance regarding standards is presumably nil. The FreeBSD man
page (e.g. at http://www.freebsd.org/cgi/man.cgi?query=tzset) has a
different wording - i.e. the colon is optional, whether it is there or
not the file interpretation is tried first - but if the colon *is*
there, *only* the file interpretation is tried.

Of course FreeBSD behaves exactly as described in its man page (I'm not
sure that the behaviour is all that useful, but it is documented) -
whereas Linux (tested on Fedora Core 5, glibc-2.4-4) appears to
completely ignore the colon - with or without colon, it tries first the
file, then the "inline" spec.

And the Solaris man page (environ(5), e.g. at
http://docs.sun.com/app/docs/doc/816-5175/6mbba7f0b?a=view#indexterm-55)
has a third version, which also seems to be an accurate description -
the colon is optional there too, but its function is arguably more
useful than on FreeBSD: It decides which interpretation to try *first*.

--Per Hedeland
per at hedeland.org




More information about the questions mailing list