Closed marklai1998 closed 2 months ago
Parsing UUIDs for timestamp information is discouraged by the RFC. This is in part because UUID timestamps may deviate from actual system clock time (ref 1, ref 2), which makes them a bit of a foot gun for anyone expecting them to be accurate.
@broofa I understand, but being discouraged doesn't mean it should be strictly prohibited in the spec it stated "Although application-specific concerns could, of course, require some degree of introspection (e.g., to examine Sections 4.1 or 4.2 or perhaps the timestamp of a UUID)", its a legit use case by the RFC
from a lib standpoint, it should provide the flexibility to do so but also warn the user when using it
I generally found this feature useful when passing UUID through multiple service, I do not have to pass in an extra timestamp, and it's not impacted by the "system time" issue
without this I would have to append extra timestamp information when transmitting a content with UUIDv7 identifier, and the timestamp might/might not be the same as the UUIDv7, unless I create a timestamp first and use the timestamp to create the UUIDv7 at scale it might be a pain to deal with if someone doesn't follow this convention
So... I don't really have time (or energy) to get into an extended discussion about this. Suffice it to say that the timestamp
field is best thought of as a counter that happens to correlate well to system time... usually... but not always. And it's that last part, that little "not always" caveat that is the reason it's use as a bonafide timestamp is discouraged.
For now, I think the best path forward would be for you or someone else to implement and publish this as a standalone module. If / when it gets significant traction and the use cases for it are better understood, we can look at adding support here.
understand, thanks for your time
Feature description
can we include a util function that allows retrieving the timestamp from a UUID V7?
Additional information
No response