Commit 854c69b9 authored by Julien Muchembled's avatar Julien Muchembled

master: do not fail on leap seconds

parent 4ebf90ec
...@@ -50,9 +50,13 @@ def packTID(utid): ...@@ -50,9 +50,13 @@ def packTID(utid):
offset, multiplicator) offset, multiplicator)
packed_higher *= multiplicator packed_higher *= multiplicator
packed_higher += value packed_higher += value
assert isinstance(lower, (int, long)), lower # If the machine is configured in such way that gmtime() returns leap
assert 0 <= lower < TID_LOW_OVERFLOW, hex(lower) # seconds (e.g. TZ=right/UTC), then the best we can do is to use
return pack('!LL', packed_higher, lower) # TID_LOW_MAX, because TID format was not designed to support them.
# For more information about leap seconds on Unix, see:
# http://en.wikipedia.org/wiki/Unix_time
# http://www.madore.org/~david/computers/unix-leap-seconds.html
return pack('!LL', packed_higher, min(lower, TID_LOW_MAX))
def unpackTID(ptid): def unpackTID(ptid):
""" """
...@@ -282,9 +286,6 @@ class TransactionManager(object): ...@@ -282,9 +286,6 @@ class TransactionManager(object):
""" """
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),
......
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