Skip to content

A Python generator for the Twitter Snowflake scheme

License

Notifications You must be signed in to change notification settings

scchengaiah/python-snowflake

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A Python generator for the Twitter Snowflake scheme in 61 lines of spacious code.

    >>> import snowflake
    >>> s = snowflake.generator(1, 1)
    >>> s.next()
    1132805160360349696
    >>> s.next()
    1132805164143611904
    >>> s.next()
    1132805168782512128

    # convenience to convert a snowflake to a unix timestamp
    >>> snowflake.snowflake_to_timestamp(1132805168782512128)
    1413056012

About

A Python generator for the Twitter Snowflake scheme

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%