erlang:now() in erlang 4.9.1 on Linux

Per Hedeland <>
Thu Apr 20 13:45:16 CEST 2000


 wrote:
>Per writes:
>
> > Do you really ever see a difference of 0 microseconds? That would be a
> > serious bug, monotonically increasing values is just about the only
> > thing erlang:now() *really* promises to produce. 
>
>Careful! "monotonic" doesn't mean what you use it to mean, I think. (*)

Sorry, yes I meant "strictly" of course, but you managed to figure that
out anyway.:-)

>The behaviour Pekka is seeing is wrong, though I think that the
>uniqueness requirement on now() should be removed. If you want
>something unique, use make_ref(). If you want to know the time, call
>now() (or time()).

The advantage of the current implementation, in addition to those that
Ulf mentions, is that it makes it possible to strictly(:-) order
timestamped events (within a node) - if I recall correctly, this was the
original motiviation for implementing it at all, the relation to
wall-clock time was even more vaguely specified back then.

>I can imagine future hardware where keeping now() both unique from
>call to call AND more or less representing the time becomes difficult.

Oh well, we can just go to nanoseconds and squeeze a few more years out
of it.:-)

--Per Hedeland




More information about the erlang-questions mailing list