[Zodb-checkins] CVS: ZODB4/ZODB - TimeStamp.py:1.1 TimeStamp.c:1.17 setup.py:1.3

Jeremy Hylton jeremy@zope.com
Fri, 22 Nov 2002 16:41:16 -0500


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

Modified Files:
	TimeStamp.c setup.py 
Added Files:
	TimeStamp.py 
Log Message:
Hide TimeStamp C extension behind veneer layer in Python.

Add newTimeStamp() function that does the messy dance all the clients
use.



=== Added File ZODB4/ZODB/TimeStamp.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
# 
##############################################################################
import time

from _TimeStamp import TimeStamp

def newTimeStamp(prev=None):
    t = time.time()
    args = time.gmtime(t)[:5] + (t % 60,)
    ts = TimeStamp(*args)
    if prev is not None:
        ts = ts.laterThan(prev)
    return ts


=== ZODB4/ZODB/TimeStamp.c 1.16 => 1.17 ===
--- ZODB4/ZODB/TimeStamp.c:1.16	Mon Jun 10 19:27:44 2002
+++ ZODB4/ZODB/TimeStamp.c	Fri Nov 22 16:41:14 2002
@@ -395,14 +395,14 @@
 
 
 void
-initTimeStamp(void)
+init_TimeStamp(void)
 {
     PyObject *m;
 
     if (TimeStamp_init_gmoff() < 0)
 	return;
 
-    m = Py_InitModule4("TimeStamp", TimeStampModule_functions,
+    m = Py_InitModule4("_TimeStamp", TimeStampModule_functions,
 		       TimeStampModule_doc, NULL, PYTHON_API_VERSION);
     if (m == NULL)
 	return;


=== ZODB4/ZODB/setup.py 1.2 => 1.3 ===
--- ZODB4/ZODB/setup.py:1.2	Mon Jun 10 19:27:44 2002
+++ ZODB4/ZODB/setup.py	Fri Nov 22 16:41:14 2002
@@ -15,5 +15,5 @@
 setup(
     name="ZODB",
     version="4.0x",
-    ext_modules=[Extension("TimeStamp", ["TimeStamp.c"])]
+    ext_modules=[Extension("_TimeStamp", ["TimeStamp.c"])]
     )