Skip to content

Commit

Permalink
Add 900ns to timestamp when creating highest timeuuid
Browse files Browse the repository at this point in the history
  • Loading branch information
thobbs committed Jan 19, 2013
1 parent 242f786 commit 7d6a6ee
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pycassa/util.py
Expand Up @@ -105,6 +105,12 @@ def convert_time_to_uuid(time_arg, lowest_val=True, randomize=False):
node = 0x808080808080L # 48 bits
else:
# Make the highest value UUID with the same timestamp

# uuid timestamps have 100ns precision, while the timestamp
# we have only has microsecond precision; to create the highest
# uuid for the same microsecond, add 900ns
timestamp = int(timestamp + 9)

clock_seq_low = 0x7fL
clock_seq_hi_variant = 0xbfL # The two most significant bits will
# 10 for the variant
Expand Down

0 comments on commit 7d6a6ee

Please sign in to comment.