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

Add optional nanos argument to uuid6 and uuid7 #51

Merged
merged 2 commits into from
Jun 14, 2024

Conversation

cstruct
Copy link
Contributor

@cstruct cstruct commented Jun 13, 2024

I wanted to test a round trip with full datetime precision of microseconds but I'm unsure how to reconstitute the sub millisecond parts, I tried to read rand_a but never managed to get it to match my numbers.

year=2024, month=1, day=2, hour=3, minute=4, second=5, microsecond=123000
)
uuid = uuid_utils.uuid7(int(ts.timestamp()), ts.microsecond * 1_000)
assert uuid.timestamp == int(ts.timestamp() * 1000)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an FYI, I changed your test to use the timestamp property of the UUID which is an extra property compared to the stdlib.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a good idea to add documentation to this project 😅

@aminalaee aminalaee changed the title Add support for setting fractional seconds when constructing v6 or v7 Add optional nanos to uuid6 and uuid7 Jun 14, 2024
@aminalaee aminalaee changed the title Add optional nanos to uuid6 and uuid7 Add optional nanos argument to uuid6 and uuid7 Jun 14, 2024
Copy link
Owner

@aminalaee aminalaee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution 👍

@aminalaee aminalaee merged commit 8c9391b into aminalaee:main Jun 14, 2024
15 checks passed
@aminalaee aminalaee mentioned this pull request Jun 17, 2024
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.

2 participants