Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snowflake

C implementation of a simple socket server replying with unique ids based on Twitters snowflake system. This might be used later in our services should it become necessary.

Instance

Binary

111111111111111111111111111111111111111111 11111 11111 111111111111
64                                         22    17    12          0

Left to right:

  • first 42 bits: amount of ms since epoch (start of 2015), retrieval: (value >> 22) + 1420070400000
  • next 5 bits: region id(defined during compile time), retrieval: (value & 0x3E0000) >> 17
  • next 5 bits: worker id(defined during compile time), retrieval: (value & 0x1F000) >> 12
  • last 12 bits: For every ID that is generated on that process, this number is incremented, retrieval: value & 0xFFF

About

C implementation of the Twitter Snowflake Unique Id System used by discord

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages