Unpack The Machine
This decoder follows the original Snowflake field widths.
EPOCH = 1288834974657 # custom epoch, ms
SEQ_BITS, MACHINE_BITS = 12, 10
def unpack(sid):
seq = sid & ((1 << SEQ_BITS) - 1)
machine = (sid >> SEQ_BITS) & ((1 << MACHINE_BITS) - 1)
ts_ms = (sid >> (SEQ_BITS + MACHINE_BITS)) + EPOCH
return ts_ms, machine, seq
print(unpack(1724551110457643015))
What does this print?
Sign in to answer questions and track your progress
Sign In