From: burris Date: Mon, 14 Oct 2002 06:11:15 +0000 (+0000) Subject: canonicalize time for accurate sorting X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=dcd4309ea49f5cb678221060bbe7e09c6a7f0bbb;p=quix0rs-apt-p2p.git canonicalize time for accurate sorting --- 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