I read this : https://stackoverflow.com/a/37605582/6426449
START_TIME = a constant that represents a unix timestamp
def make_id():
t = int(time.time()*1000) - START_TIME
u = random.SystemRandom().getrandbits(23)
id = (t << 23 ) | u
return id
def reverse_id(id):
t = id >> 23
return t + START_TIME
From above def, How to get t
and u
of id
(It's generated from def make_id
)?
Like
def get_t(id):
some methods
return t
def get_u(id):
some methods
return u