segmentio / ksuid

K-Sortable Globally Unique IDs
https://segment.com/blog/a-brief-history-of-the-uuid/
MIT License
4.82k stars 174 forks source link

Passing a timestamp before the epoch to FromParts does not return an error #58

Open justinruggles opened 2 years ago

justinruggles commented 2 years ago

It seems that it wraps around rather than returning an error.

https://go.dev/play/p/s2aA3-ERd-E

Uses timestamp 2000-01-01T00:00:00.00Z and zeros for the payload. Returns: WfeXVK2UN8Qh86bSI6R4zNvC7ge

$ ksuid -f inspect WfeXVK2UN8Qh86bSI6R4zNvC7ge

REPRESENTATION:

  String: WfeXVK2UN8Qh86bSI6R4zNvC7ge
     Raw: E4FAF58000000000000000000000000000000000

COMPONENTS:

       Time: 2136-02-07 01:28:16 -0500 EST
  Timestamp: 3841652096
    Payload: 00000000000000000000000000000000