[Zope3-checkins] CVS: ZODB4/ZODB - utils.py:1.13

Jeremy Hylton jeremy@zope.com
Thu, 1 Aug 2002 12:11:04 -0400


Update of /cvs-repository/ZODB4/ZODB
In directory cvs.zope.org:/tmp/cvs-serv11370/ZODB

Modified Files:
	utils.py 
Log Message:
Simplify.




=== ZODB4/ZODB/utils.py 1.12 => 1.13 ===
 # FOR A PARTICULAR PURPOSE.
 # 
 ##############################################################################
-import TimeStamp, time, struct
+from ZODB.TimeStamp import TimeStamp
+import struct
+import time
 
-def p64(v, pack=struct.pack):
+def p64(v):
     """Pack an integer or long into a 8-byte string"""
-    return pack(">Q", v)
+    return struct.pack(">Q", v)
 
 # Note that the distinction between ints and longs is blurred in
 # Python 2.2.  So make u64() and U64() the same.
 
-def u64(v, unpack=struct.unpack):
+def u64(v):
     """Unpack an 8-byte string into a 64-bit long integer."""
-    return unpack(">Q", v)[0]
+    return struct.unpack(">Q", v)[0]
 
 U64 = u64
 
@@ -32,7 +34,7 @@
 def cp(f1, f2, l):
     read = f1.read
     write = f2.write
-    n =8192
+    n = 8192
     
     while l > 0:
         if n > l:
@@ -44,11 +46,9 @@
         l = l - len(d)
 
 
-def newTimeStamp(old=None,
-                 TimeStamp=TimeStamp.TimeStamp,
-                 time=time.time, gmtime=time.gmtime):
-    t = time()
-    ts = TimeStamp(gmtime(t)[:5]+(t%60,))
+def newTimeStamp(old=None):
+    t = time.time()
+    ts = TimeStamp(time.gmtime(t)[:5]+(t%60,))
     if old is not None:
         return ts.laterThan(old)
     return ts