earthsnake/earthsnake/util.py

12 lines
237 B
Python
Raw Normal View History

2022-04-12 13:25:29 +00:00
from datetime import datetime
from random import random
def microsecond_now() -> int:
return int(datetime.utcnow().timestamp() * 1000)
def random_id() -> str:
# TODO: better randomness here
return f'{random()}{random()}'