News for hackers. Stuff that matters.
Re:Nanosecond timestamp collisions are common by junon on Friday July 21, 2023 @05:40AM (#36811866)
Don't even need the "same millisecond" part to save a few cycles, use case depending. An overflowing increment with a counter of any sort plus a few random bits is usually enough.

If you're clever enough, neither needs a branch.

Re:Nanosecond timestamp collisions are common by SV_BubbleTime on Friday July 21, 2023 @12:20PM (#36815707)
UUIDv7 has two at least two such monotonic strategies. You can use a counter, or you can use those bytes to increase the random entropy.