Uniq.UUID.uuid1
You're seeing just the function
uuid1
, go back to Uniq.UUID module for more information.
Specs
Generates a UUID using the version 1 scheme, as described in RFC 4122
This scheme is based on a few key properties:
- A timestamp, based on the count of 100-nanosecond intervals since the start of the Gregorian calendar, i.e. October 15th, 1582, in Coordinated Universal Time (UTC).
- A clock sequence number, used to ensure that UUIDs generated with the same timestamp are still unique, by incrementing the sequence each time a UUID is generated with the same timestamp as the last UUID that was generated. This sequence is initialized with random bytes at startup, to protect against conflicts.
- A node identifier, which is based on the MAC address of one of the network interfaces
on the system, or if unavailable, using random bytes. In our case, we specifically look
for the first network interface returned by
:inet.getifaddrs/0
that is up, broadcastable, and has a hardware address, otherwise falling back to cryptographically strong random bytes.
Specs
uuid1(clock_seq :: non_neg_integer(), node :: <<_::48>>, format()) :: t()
This function is the same as uuid/1
, except the caller provides the clock sequence
value and the node identifier (which must be a 6-byte binary).
See uuid/1
for details.