Skip to content

Generate different IDs even on the same second.#2

Open
musically-ut wants to merge 1 commit into
alexksikes:masterfrom
musically-ut:patch-2
Open

Generate different IDs even on the same second.#2
musically-ut wants to merge 1 commit into
alexksikes:masterfrom
musically-ut:patch-2

Conversation

@musically-ut

Copy link
Copy Markdown

time.ctime() only returns the current time with the precision of seconds. That is inadequate in case two applications arrive on the same second. Hence, including a call to random.random() which will ensure that the IDs for these cases are different (on any system which provides os.urandom()).

`time.ctime()` only returns the current time with the precision of seconds. That is inadequate in case two applications arrive on the same second. Hence, including a call to `random.random()` which will ensure that the IDs for these cases are different (on any system which provides `os.urandom()`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant