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

Get timestamp working with millisecond accuracy, add tests #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nickhobbs94
Copy link

I noticed that the UUIDs from this library weren't matching what I was getting from packages in npm. I then saw this issue which said it was definitely a problem:
#1

I've gone ahead and dropped nanosecond support to get this library matching the results of other ones. It looks like the variable accuracy timestamps have been dropped from the latest draft I can find of the UUIDv7 spec and it's just millisecond accuracy now: https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-04.html#name-uuid-version-7

Let me know if you think I've done anything wrong or you're not happy with a direction I've taken. Happy to fix up any issues.

@nickhobbs94
Copy link
Author

Note this will be a breaking change in the ordering and may need to be indicated with a version bump

@RzNmKX
Copy link

RzNmKX commented Mar 21, 2024

I noticed that the UUIDs from this library weren't matching what I was getting from packages in npm. I then saw this issue which said it was definitely a problem: #1

I've gone ahead and dropped nanosecond support to get this library matching the results of other ones. It looks like the variable accuracy timestamps have been dropped from the latest draft I can find of the UUIDv7 spec and it's just millisecond accuracy now: https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-04.html#name-uuid-version-7

Let me know if you think I've done anything wrong or you're not happy with a direction I've taken. Happy to fix up any issues.

I used your code to update uuid7.com with the millisecond precision draft, thanks for the code!

RzNmKX/uuid7-flask#1

@mullenkamp
Copy link

FYI, this RFC is newer and has the sub-millisecond option:
https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-7

Funny that there are so many standards docs for this...

@dpldgr
Copy link

dpldgr commented Nov 1, 2024

FYI, this RFC is newer and has the sub-millisecond option: https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-7

Funny that there are so many standards docs for this...

That is just the RFC for UUIDv7. Note that this repo was created when this RFC was in draft, and correctly implemented that draft as it was at the time. In subsequent draft revisions the UUIDv7 format changed but this repo was never updated to comply with the revised drafts and then the finalised RFC. I think the mistake here was using the package name "uuid7" for any implementation of a draft, which has misled many people into believing it must be an implementation of the finalised RFC.

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

Successfully merging this pull request may close these issues.

4 participants