[erlang-questions] Setting TZ variable

Jachym Holecek freza@REDACTED
Thu Dec 2 20:46:16 CET 2010


# 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...

Regards,
	-- Jachym


More information about the erlang-questions mailing list