TimeOrdered functionv0.1.0
A version 7 UUID: the current time in its leading bits, entropy in the rest.
pub func TimeOrdered() -> Uuid ! EntropyError
Fails with why entropy was unavailable rather than producing a timestamp-shaped value with no randomness — which would be guessable and would look fine.
Returns: a version 7 value carrying the current time, or why entropy was unavailable
Related
TimeOrderedAt
pub func TimeOrderedAt(milliseconds: uint64) -> Uuid ! EntropyError
A version 7 UUID for a given millisecond, with entropy in the rest. For reproducing an identifier from a recorded time, and for testing.
Parameters
| Name | Type | Description |
|---|---|---|
milliseconds | uint64 | the timestamp to embed, in milliseconds since the Unix epoch |
Returns: a version 7 value carrying milliseconds, or why entropy was unavailable
MillisecondOf
pub func MillisecondOf(value: &Uuid) -> uint64
The millisecond a version 7 UUID carries. Meaningless for any other version, which is why the version should be checked first.
Parameters
| Name | Type | Description |
|---|---|---|
value | &Uuid | the value to act on |
Returns: the timestamp a version 7 value carries; meaningless for any other version