Commit fb6ffb7b authored by Vincent Pelletier's avatar Vincent Pelletier

Drop "% 60" in TID generator.

This should never trigger, as gmtime bases itself on a unix epoch
timestamp which is non-monotonous on leap seconds. So gmtime cannot
return second count above 59.
parent fc15ecd3
...@@ -284,10 +284,13 @@ class TransactionManager(object): ...@@ -284,10 +284,13 @@ class TransactionManager(object):
assert isinstance(divisor, (int, long)), repr(divisor) assert isinstance(divisor, (int, long)), repr(divisor)
tm = time() tm = time()
gmt = gmtime(tm) gmt = gmtime(tm)
# See leap second handling in epoch:
# https://en.wikipedia.org/wiki/Unix_time
assert gmt.tm_sec < 60, tm
tid = packTID(( tid = packTID((
(gmt.tm_year, gmt.tm_mon, gmt.tm_mday, gmt.tm_hour, (gmt.tm_year, gmt.tm_mon, gmt.tm_mday, gmt.tm_hour,
gmt.tm_min), gmt.tm_min),
int((gmt.tm_sec % 60 + (tm - int(tm))) / SECOND_PER_TID_LOW) int((gmt.tm_sec + (tm - int(tm))) / SECOND_PER_TID_LOW)
)) ))
min_tid = self._last_tid min_tid = self._last_tid
if tid <= min_tid: if tid <= min_tid:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment