Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 26 Oct 2012 10:34:06 +0200
From: Yoran Heling <info@...hel.nl>
To: musl@...ts.openwall.com
Subject: Re: localtime() isn't local

On 2012-10-26, Szabolcs Nagy wrote:
> * Yoran Heling <info@...hel.nl> [2012-10-26 09:57:37 +0200]:
> >   $ musl-gcc localtime.c -o localtime-musl
> >   $ gcc localtime.c -o localtime-glibc
> >   $ ./localtime-musl
> >   Local:  07:53:47 
> >   Global: 07:53:47
> >   $ ./localtime-glibc
> >   Local:  09:53:50 
> >   Global: 07:53:50
> >   $ date
> >   Fri Oct 26 09:53:51 CEST 2012
> > 
> 
> what is the TZ environment variable?
> 
> that's the only method localtime (and tzset)
> should support in posix to determine the timezone
> 
> you may want to try
> 
> TZ=CEST ./localtime-musl

Ah, I didn't realize that the use of /etc/localtime wasn't part of
POSIX. I don't have a TZ variable set, so that explains the output.
TZ=CEST didn't work, but TZ=CEST-2 did the trick.

This is quite a bummer, though. I use musl to create static binaries for
Linux, and every glibc-based distribution (i.e. the vast majority) uses
/etc/localtime rather than the TZ variable. :-(

Thanks for the clarification.

Yoran

Powered by blists - more mailing lists

Your e-mail address:

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