[Neo-report] r2468 vincent - /trunk/neo/master/transactions.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Nov 22 09:51:09 CET 2010


Author: vincent
Date: Mon Nov 22 09:51:09 2010
New Revision: 2468

Log:
Define constants for TID's lower half's overflow and duration of a unit.

Modified:
    trunk/neo/master/transactions.py

Modified: trunk/neo/master/transactions.py
==============================================================================
--- trunk/neo/master/transactions.py [iso-8859-1] (original)
+++ trunk/neo/master/transactions.py [iso-8859-1] Mon Nov 22 09:51:09 2010
@@ -21,6 +21,10 @@ from datetime import timedelta, datetime
 from neo.util import dump
 import neo
 
+TID_LOW_OVERFLOW = 2**32
+TID_LOW_MAX = TID_LOW_OVERFLOW - 1
+SECOND_PER_TID_LOW = 60.0 / TID_LOW_OVERFLOW
+
 class Transaction(object):
     """
         A pending transaction
@@ -172,11 +176,11 @@ class TransactionManager(object):
         gmt = gmtime(tm)
         upper = make_upper(gmt.tm_year, gmt.tm_mon, gmt.tm_mday, gmt.tm_hour,
             gmt.tm_min)
-        lower = int((gmt.tm_sec % 60 + (tm - int(tm))) / (60.0 / 65536.0 / 65536.0))
+        lower = int((gmt.tm_sec % 60 + (tm - int(tm))) / SECOND_PER_TID_LOW)
         tid = pack('!LL', upper, lower)
         if self._last_tid is not None and tid <= self._last_tid:
             upper, lower = unpack('!LL', self._last_tid)
-            if lower == 0xffffffff:
+            if lower == TID_LOW_MAX:
                 # This should not happen usually.
                 d = datetime(gmt.tm_year, gmt.tm_mon, gmt.tm_mday,
                              gmt.tm_hour, gmt.tm_min) + timedelta(0, 60)





More information about the Neo-report mailing list