[asterisk-dev] POSIX timezone handling

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Mon Oct 1 15:36:05 CDT 2007


On Monday 01 October 2007 03:45, Henning Holtschneider wrote:
> On Mon, 1 Oct 2007 10:06:26 +0200 Tzafrir Cohen wrote:
> > On Mon, Oct 01, 2007 at 09:26:25AM +0200, Henning Holtschneider wrote:
> > > I've got a system which only provides POSIX-style timezone
> > > information through /etc/TZ and the TZ environment variable.
> > > Unfortunately, Asterisk doesn't seem to care about the timezone and
> > > defaults to GMT.
> >
> > Isn't it a matter for libc to do this dirty work?
>
> I thought so, but if I look at the code in main/stdtime/localtime.c, it
> seems as if Asterisk parses the zoninfo files itself. The sparse
> comments indicate that there is support for POSIX timezones, too. But I
> don't understand how the code is supposed to distinguish between
> zoneinfo files and a POSIX-style timezone definition (see
> <http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html>
> for the definition of the POSIX TZ format).

We made no provision for the alternate format, as zoneinfo files are already
compressed.  The reason why we do the parsing ourselves is that the standard
time functions make no allowance whatsoever to handle different timezones in
different threads.  Were POSIX to create an API to allow us to do this, I
would very happily change Asterisk to use that.

> I can copy a valid zoneinfo file onto the device and symlink it
> to /etc/localtime, but the zoneinfo files are way too big to be used
> on my device.

That is indeed what you will have to do.

-- 
Tilghman



More information about the asterisk-dev mailing list