Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 26 Oct 2012 13:41:30 -0400
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: localtime() isn't local

On Fri, Oct 26, 2012 at 06:25:53PM +0200, Szabolcs Nagy wrote:
> * Isaac Dunham <idunham@...abit.com> [2012-10-26 07:37:20 -0700]:
> > FWIW, the last line in /etc/localtime seems in proper format for the TZ variable (that is, export TZ=`tail -n 1 /etc/localtime` should give you a valid POSIX timezone).  I don't know why there's so much more cruft, and I've only checked with my timezone.
> > 
> > Isaac Dunham <idunham@...abit.com>
> 
> that's not always true as the posix tz format
> cannot represent any timezone
> 
> in my tzdata files these are counter examples:
> [...]

The zoneinfo format has several advantages over plain POSIX TZ. The
one that affects almost everyone is the ability to represent
historical changes in timezones. With POSIX TZ, times in the past will
be converted to local time based on the _current_ rules for the user's
timezone locality. With zoneinfo, the historical rule in use at the
time being converted gets used.

In addition, some timezones have rules which are sufficiently
arbitrary (and often ridiculous) so as to preclude any simple
algorithmic conversion. For those, even present and future dates need
the zoneinfo rules for conversion.

The format is basically a list of unix time ranges along with offsets
that apply for the ranges. Parsing it is mildly painful, but not too
bad. At first glance, mmapping the zoneinfo file looks like the best
approach.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.