Re:How Discord Stores Billions of Messages (2017)
by karmanyaahm on Tuesday August 24, 2021 @10:10PM
(#28297343)
IIRC a snowflake ID's first few bits (or characters?) are by definition a unix timestamp.
Re:How Discord Stores Billions of Messages (2017)
by greenbeans1991 on Tuesday August 24, 2021 @10:26PM
(#28297420)
Ah it gets rid of the non-time related bits. Below is a description of the formatting
* id is composed of: * time - 41 bits (millisecond precision w/ a custom epoch gives us 69 years) * configured machine id - 10 bits - gives us up to 1024 machines * sequence number - 12 bits - rolls over every 4096 per machine (with protection to avoid rollover in the same ms)
thanks :)
`timestamp = snowflake_id >> 22`
Thanks :)