Closed stevesimmons closed 2 years ago
Thank you for reporting this bug. I may have skimmed the decoding part of the RFC when I implemented it. I'll try to fix it and update the Nuget Package this week.
Fixed by commit e6b0eb16771e6baf718d724249aa23c6a9308ec6
The source code for UUIDv7 places the ms value (0-999) in the lower 12 bits (0-4095) of bytes 5 and 6:
Doesn't this mean the timestamps implied by UUIDNext's UUIIDv7 will be parsed as having fractional seconds ranging from x.000... secs to x.000244 secs (=999/4096), and then in the next millisecond jump to (x+1).000... secs? i.e. leaving a gap of 756us.
The proposed UUIDv7 spec says at L858 of https://github.com/uuid6/uuid6-ietf-draft/blob/master/draft-peabody-dispatch-new-uuid-format-02.txt:
In your case, the subsecond value comes from
unixTimeStamp.Milliseconds
rather than being a binary fraction. So I think you should multiply the number of ms by 4096 and take the remainder module 1000.