[erlang-questions] erlang:now() incremental guaranty scope

Daniel Luna daniel@REDACTED
Fri Jan 27 16:43:39 CET 2012


2012/1/26 Ignas Vyšniauskas <baliulia@REDACTED>:
> the docs on erlang:now/0 say that
>> It is also guaranteed that subsequent calls to this BIF returns
>> continuously increasing values.
>
> What is the scope of this guaranty?
> Is this guaranteed for calls from the same process/calls within the same
> node/calls within the same runtime-system?

It is guaranteed that calls on a single node are continuously
increasing (which also implies unique).

If you want a globally unique value you can use {node(), now()}, which
is guaranteed to be unique barring restarts with clock drift (or
between nodes with the same name, I guess).

/Daniel



More information about the erlang-questions mailing list