bpo-31784: Use time.time_ns() in uuid.uuid1() by vstinner · Pull Request #11189 · python/cpython
uuid.uuid1() now calls time.time_ns() rather than int(time.time() * 1e9). Replace also int(nanoseconds/100) with nanoseconds // 100.
| global _last_timestamp | ||
| import time | ||
| nanoseconds = int(time.time() * 1e9) | ||
| nanoseconds = time.time_ns() |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why int(time.time() * 1e9) == time.time_ns() is False? Must be True, isn't?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
time.time_ns() == time.time_ns() is false because clock changes each time you call it :-)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ho! you are right, I was confused
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters