[erlang-questions] Setting TZ variable

Alexey Romanov <>
Thu Dec 2 21:29:21 CET 2010


On Thu, Dec 2, 2010 at 10:46 PM, Jachym Holecek <> 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...

> Regards,
>        -- Jachym
>



-- 
Yours, Alexey Romanov


More information about the erlang-questions mailing list