summaryrefslogtreecommitdiffstats
path: root/Lib/uuid.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2006-08-18 03:40:13 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2006-08-18 03:40:13 (GMT)
commit2c3a256351488b0729437d59162e5181a3ab4dd1 (patch)
tree7e5cc003d9a4846478373a5b2abde0087b3f2fbf /Lib/uuid.py
parent552262409dffc06b57c64ca8bfe011b8a10b2453 (diff)
downloadcpython-2c3a256351488b0729437d59162e5181a3ab4dd1.zip
cpython-2c3a256351488b0729437d59162e5181a3ab4dd1.tar.gz
cpython-2c3a256351488b0729437d59162e5181a3ab4dd1.tar.bz2
Bug #1541863: uuid.uuid1 failed to generate unique identifiers
on systems with low clock resolution.
Diffstat (limited to 'Lib/uuid.py')
-rw-r--r--Lib/uuid.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/uuid.py b/Lib/uuid.py
index 684bbeb..ae3da25 100644
--- a/Lib/uuid.py
+++ b/Lib/uuid.py
@@ -488,8 +488,8 @@ def uuid1(node=None, clock_seq=None):
# 0x01b21dd213814000 is the number of 100-ns intervals between the
# UUID epoch 1582-10-15 00:00:00 and the Unix epoch 1970-01-01 00:00:00.
timestamp = int(nanoseconds/100) + 0x01b21dd213814000L
- if timestamp == _last_timestamp:
- timestamp += 1
+ if timestamp <= _last_timestamp:
+ timestamp = _last_timestamp + 1
_last_timestamp = timestamp
if clock_seq is None:
import random