Open rex-remind101 opened 1 year ago
I'd also love to see this feature
I'd also like this! Also, @nthState-Chris funny finding you here? Hahaha
Hi @shaps80 great to hear from you! I hope you are well? I actually wrote a small Swift Package to generate UUID V7 strings...it seems to work: https://github.com/nthState/UUIDV7
The main issue is getting a good quality timestamp. IMO the spec is a little bit ambiguous, because the section on UUIDv7 says the timestamp should be:
the number of milliseconds since midnight 1 Jan 1970 UTC, leap seconds excluded.
While other parts of the spec say that the timestamp only needs to be monotonic (BTW, Foundation's Date()
initialiser does not make that guarantee), and that
This specification makes no requirement or guarantee about how close the clock value needs to be to the actual time
So it's unclear if we need to care about leap seconds or not. Previously I thought maybe we did, but now I'm leaning towards thinking that we don't (which is easier to implement, thankfully). One of the things on my to-do list is to send some feedback about that.
There are also a number of configuration options. The spec only requires the timestamp have millisecond precision, but there is another field for additional monotonic data, which may be the sub-millisecond portion of the timestamp, a counter, or some combination of the two. I'm debating how much of this to surface in the API; I always like exposing the knobs and dials so professionals can adjust the behaviour for their environment.
I have some other things going on which take priority, but I haven't forgotten about this and hope to get to it in a week or two (more likely two).
Yeah I can imagine its a little ambiguous. Appreciate you feeding back. Take your time, I know exactly how you feel haha!
Thank you for building this library. May support be added for uuidv7?