From dcd4309ea49f5cb678221060bbe7e09c6a7f0bbb Mon Sep 17 00:00:00 2001 From: burris Date: Mon, 14 Oct 2002 06:11:15 +0000 Subject: [PATCH] canonicalize time for accurate sorting --- actions.py | 2 +- khashmir.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/actions.py b/actions.py index ce7bfc6..054f886 100644 --- a/actions.py +++ b/actions.py @@ -181,7 +181,7 @@ class KeyExpirer: reactor.callLater(const.KEINITIAL_DELAY, self.doExpire) def doExpire(self): - self.cut = `time() - const.KE_AGE` + self.cut = "%0.6f" % (time() - const.KE_AGE) self._expire() def _expire(self): diff --git a/khashmir.py b/khashmir.py index 9c7b2ef..93061f5 100644 --- a/khashmir.py +++ b/khashmir.py @@ -258,15 +258,15 @@ class Khashmir(xmlrpc.XMLRPC): return nodes, self.node.senderDict() def xmlrpc_store_value(self, key, value, sender): - t = `time.time()` - s = "insert into kv values ('%s', '%s', '%s')" % (key, value, t) + t = "%0.6f" % time.time() + s = "insert into kv values ('%s', '%s', '%s');" % (key, value, t) c = self.store.cursor() try: c.execute(s) except pysqlite_exceptions.IntegrityError, reason: if reason == 'constraint failed': # update last insert time - s = "update kv set time = '%s' where key = '%s' and value = %s" % (key, value) + s = "update kv set time = '%s' where key = '%s' and value = %s; commit;" % (t, key, value) c.execute(s) else: raise pysqlite_exceptions.IntegrityError, reason -- 2.39.5