gh-130843: expose 48-bit timestamp for UUIDv7#131838
Conversation
| * - .. attribute:: UUID.time | ||
| - The 60-bit timestamp. | ||
| - The 60-bit timestamp for version 1 and 6, | ||
| or the 48-bit timestamp for version 7. |
There was a problem hiding this comment.
What is the timestamp unit? Seconds? Is it using UNIX timestamp Epoch (1970-01-01 at 00:00)? You don't have to document it if it's complicated, I'm just curious.
There was a problem hiding this comment.
I'll repost here for posterity:
There is no "unit" here and the caller is responsible to handle it as it depends on the version. What's important is that we can recover the timestamp that was generated during UUID construction without having to do bits operations ourselves (for UUIDv7 it's easy because it's 48 first bits of the UUID but for UUIDv1 and v6, the timestamp is split into multiple chunks and those chunks are put in different places of the resulting UUID object).
|
|
I doubtz this has something to do with my change |
(skip news because the feature was added in the latest alpha and thus it wouldn't really make sense to have a separate news entry; if we can't make it in 3.14, I'll add a NEWS entry though)
📚 Documentation preview 📚: https://cpython-previews--131838.org.readthedocs.build/