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 config to use all 64 bits #48

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

Add config to use all 64 bits #48

wants to merge 1 commit into from

Conversation

theory
Copy link
Contributor

@theory theory commented Oct 22, 2023

Add Use64Bits to Settings. When true, the bit length used for time will be 40 instead of 39. This allows for the generation of unique IDs for over 348 years from the start date.

Done by adding the bitLenTime field to the Sonyflake struct and using its value (39 or 40) to detect time overflows, rather than the constant BitLenTime. The new constant BitLenTimeUint is set to 40.

Update docs and note that values converted to int64 after 174 years will be negative.

Add `Use64Bits` to Settings. When true, the bit length used for time
will be 40 instead of 39. This allows for the generation of unique IDs
for over 348 years from the start date.

Done by adding the `bitLenTime` field to the Sonyflake struct and using
its value (39 or 40) to detect time overflows, rather than the constant
`BitLenTime`. The new constant `BitLenTimeUint` is set to 40.

Update docs and note that values converted to `int64` after 174 years
will be negative.
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.

1 participant