Implementing

Variants

View this section in the spec ↗

The 2 TNID variant bits select how the 100 payload bits are read, as the version does for a UUID.

TNID variantBitsSimilar toPayload
Variant 00b00UUIDv743-bit ms timestamp + 57 random bits; time-sortable
Variant 10b01UUIDv4100 random bits
Variant 20b10Reserved
Variant 30b11Reserved

Reserved variants

No definition yet, so nothing to generate. Parsers SHOULD accept them, so TNIDs from a future spec version round-trip through older code. Treat the payload as opaque.

Which to use: Choosing a variant.

  1. 01 Variant 0: time-sortableVariant 0 TNIDs store a 43-bit millisecond timestamp and 57 random bits, so they sort by creation time.
  2. 02 Variant 1: randomVariant 1 TNIDs fill all 100 payload bits with random data, like UUIDv4.