[erlang-questions] Setting TZ variable

Ulf Wiger ulf.wiger@REDACTED
Fri Dec 3 08:29:19 CET 2010

On 3 Dec 2010, at 05:19, Alain O'Dea wrote:

> On Thursday, December 2, 2010, Alexey Romanov
>> Ah no, I need precisely to handle actual timezone change (the system
>> only finds at runtime what timezone it's in by asking a server...)
> This sounds like a one-time or synchronized operation so I see no
> issue with os:setenv("TZ",...) for that :)

So, the original advice came from the AXD 301 days, where we had to deal
with timezone and DST issues in a non-stop system. Running on Solaris,
at the time, updating the zoneinfo files was an OS patch each time, and there
were ca 200 different settings. Timezone is relatively straightforward - at least
the AXD 301 tended not to move once brought into service, but DST is really
a PITA; some countries decide through parlamentary decision when it's 
supposed to happen each year, and others have different rules for years 
with presidential elections…

Also, we needed to get the time representation in logs correct (i.e. correct
localtime) - not just the time presented in the GUI.

Granted, it was early days for OTP, so some of our issues have long-since
been fixed. Initially, there was no erlang:universaltime(), and if the OS time
changed to DST, this would affect erlang:now() and all timers in the system, 
so we set the system clock to UST and tweaked the TZ variable from within Erlang.

Ulf W

Ulf Wiger, CTO, Erlang Solutions, Ltd.

More information about the erlang-questions mailing list