Time based UUID not using current time stamp
nagamanikandank opened this issue · 3 comments
@cowtowncoder , I used the following code Generators.timeBasedGenerator().generate()
to generate time based UUID. On the generated UUID, I found the timestamp using Java's UUID.timestamp()
, I see the timestamp is not current time . Is there a way to generate UUID with current time stamp?
@nagamanikandank I don't understand -- timestamp is generated from the current timestamp, but it has to avoid duplicates, as well as translate from milliseconds of current time to 100 nsec (or whatever granularity is as specified by UUID spec), it gets translated to complaint value.
So what exactly is your problem? Timestamp in UUID is not meant to be used for knowing current time but merely for providing uniqueness and potentially loose ordering within values produced by a single host.
@cowtowncoder . I am not very clear in the way I wrote the question I think. Sorry. My Question is , does Generators.timeBasedGenerator().generate()
, use the current time to generate UUID, or some random time to generate the Id
@nagamanikandank It uses current time to generate time/location-based UUID (one produced by timeBasedGenerator()).