Generating unique ids in Mnesia
Mark Scandariato
mfs@REDACTED
Thu Aug 18 17:29:04 CEST 2005
If you don't mind gaps in the sequence numbers, then try:
seq() ->
{M,S,U} = erlang:now(),
<<N:64>> = <<M:24, S:20, U:20>>,
N.
Mark.
-----Original Message-----
From: Joel Reymont <joelr1@REDACTED>
Sent: Aug 18, 2005 11:12 AM
To: Erlang Users' List <erlang-questions@REDACTED>
Subject: Re: Generating unique ids in Mnesia
Hakan,
Thanks for the tip but I need sequential, increasing numerical
values. I would like my records to be sequantially numbered and the
sequence number to increase every time I insert a record. How do I
manage that?
Joel
On Aug 18, 2005, at 4:46 PM, Hakan Mattsson wrote:
> You can use
>
> erlang:now()
>
> or
>
> {node(), erlang:now()}
>
> in a multi node system.
More information about the erlang-questions
mailing list