Search code examples
cassandrauuiddatastax-java-driver

How does the com.datastax.driver.core.utils.UUIDs.startOf works?


I've read the documentation of com.datastax.driver.core.utils.UUIDs.startOf, but I still don't understand how two slightly different UUIDs give the same timestamp. The UUIDs are:

  • ceec16b0-fbd7-11e9-0000-016e21bbe39d
  • ceec16b0-fbd7-11e9-0000-016e21bbe39c

Running these through startOf gives the output below. What I find strange is that both the timestamp and Unix timestamp are the same, even though the last character of the UUIDs differ between them. enter image description here

Can anyone clarify how the UUIDs are converted to timestamps?


Solution

  • UUID for same millisecond has a space to accommodate up to 10,000 different values (based on the 100-nanosecond intervals as per standard). Java driver, has a code that counts from 1 to 10,000 and don't allow to generate more values during that millisecond.