[erlang-questions] Setting TZ variable

Dmitriy Kargapolov dmitriy.kargapolov@REDACTED
Thu Dec 2 21:52:03 CET 2010


On Thu, Dec 2, 2010 at 3:29 PM, Alexey Romanov
<alexey.v.romanov@REDACTED>wrote:

> On Thu, Dec 2, 2010 at 10:46 PM, Jachym Holecek <freza@REDACTED> wrote:
> > # Ulf Wiger 2010-12-02:
> >> Hmm…
> >>
> >> At least it works on  my Macbook: [... it works ...]
> >
> > Well, localtime(3) is specified (in POSIX.1) to behave as if it calls
> > tzset(3) every time, but no such promise is made for localtime_r(3).
> > So on some platforms that provide localtime_r(3), the tzset(3) call
> > in erts/emulator/sys/unix/sys.c:erl_sys_init() may be the only time
> > TZ variable is ever taken into consideration.
> >
> > Unfortunately, there doesn't seem to be a standard API for conversions
> > between different timezones in the C library -- it has zoneinfo around
> > and enough functions to process it, but is simply too greedy to export
> > that functionaly.
> >
> > Not that this actually helps anyone, but perhaps it explains different
> > behaviours on different platforms...
>
> (Initially sent off the list) Actually, it does: it suggests it should
> be enough to write a program in C which calls tzset(3) and call it
> through a port...
>

It's not, really... In general you cannot convert local time to universal
time in unambiguous way using POSIX calls... At least twice a year in DST
environment :) As mentioned above, timezone info functions are not exported
in glibc...

>
> > Regards,
> >        -- Jachym
> >
>
>
>
> --
> Yours, Alexey Romanov
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
>


More information about the erlang-questions mailing list