Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clock_gettime(CLOCK_REALTIME, &ts) is not monotonic #41

Open
trim21 opened this issue Oct 23, 2024 · 0 comments
Open

clock_gettime(CLOCK_REALTIME, &ts) is not monotonic #41

trim21 opened this issue Oct 23, 2024 · 0 comments

Comments

@trim21
Copy link

trim21 commented Oct 23, 2024

CLOCK_REALTIME may go backward, make generated uuid not sortable.

Normally uuid v7 generator will save last timestmap and use last_ts + 1 as current time if result of CLOCK_REALTIME is less then last timestamp.

for example:
https://github.com/google/uuid/blob/0e97ed3b537927cb4afea366bc4cc36f6eb37e75/version7.go#L97
https://github.com/lefred/mysql-component-uuid_v7/blob/924b55e37f406812ca7ce4d84d877e18e3fe53e3/uuid_v7.h#L130

will be fixed by #15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant