time syncronization in erlang cluster

Ulf Wiger <>
Sat Jan 10 01:20:41 CET 2004


On Fri, 9 Jan 2004 20:58:44 +0100 (CET), Per Hedeland 
<> wrote:

> Ulf Wiger <> wrote:
>>
>> Of course there's a catch:
>>
>> If the computer running the Erlang node is set for
>> any other timezone than Universal Time (UDT), the
>> system clock will make jumps that erlang:now() will
>> not be able to adjust to within reasonable time.
>
> Hmm?? On a sensible OS (e.g. Unix or derivatives) there are no jumps,
> since the system clock (and erlang:now()) always runs on UTC/GMT. The
> time zone, including Daylight Savings Time changes (I assume those are
> the jumps you're thinking of) is just a matter of how applications
> display time to the user. Indeed, each user can have his own time zone
> setting.

My fingers ran ahead of my brain there. There was a wholly different
reason why we started messing with the TZ variable: keeping an up-to-date
timezone file when delivering to all corners of the world, and doing
it with Solaris patches, is simply not feasible. We chose to let the
operator define the desired timezone through a web page, and then use
os:getenv/2 (more or less - our solution predates setenv). Thus, only
the erlang node knows the correct local time -- everything else is
in universal time.

Checking for discrepancies between the system clock and erlang:now()
is more to protect against e.g. handling errors; stuff that shouldn't
happen but invariably does.

/Uffe
-- 
Ulf Wiger




More information about the erlang-questions mailing list