time syncronization in erlang cluster

Ulf Wiger <>
Thu Jan 8 19:08:30 CET 2004


On Thu, 8 Jan 2004 14:19:46 +0100, WILLIAMS Dominic 
<> wrote:

> Hi Pete,
>
>> What is the platform? If you're using a flavour of UNIX, you
>> may wish to use NTP (network time protocol RFC 1305) and
>> bypass Erlang for synchronisation. I imagine there are NTP
>> clients and servers implemented for most platforms.
>
> Indeed, including Windows (just don't use Microsoft's built-in
> version, which is simplified, if you want the features I
> described in my previous post).
>
> However, this doesn't work, at least for Erlang systems running
> uninterruptedly, if the Erlang runtime only gets the system time
> at start-up...

This is how erlang:now() works.

At startup, it samples the system time, and then it starts running
loosely coupled to the system time. That is, it periodically samples
the system time and makes small adjustments (+/- 1%) so that it
will eventually converge with the actual system time ("eventually"
may be an arbitrarily long time, depending on what happens to the
system time.)

So to answer your initial question: you cannot synchronize erlang:now(),
since it is designed to adjust itself to e.g. NTP, while preserving the
property that subsequent calls to erlang:now() should always return
unique values in increasing order.

/Uffe
-- 
Ulf Wiger




More information about the erlang-questions mailing list