[or-cvs] r19658: {torctl} Preserve UTC timezone info on the 'published' member of Rout (torctl/trunk/python/TorCtl)

mikeperry at seul.org mikeperry at seul.org
Mon Jun 8 05:04:49 UTC 2009


Author: mikeperry
Date: 2009-06-08 01:04:49 -0400 (Mon, 08 Jun 2009)
New Revision: 19658

Modified:
   torctl/trunk/python/TorCtl/TorCtl.py
Log:

Preserve UTC timezone info on the 'published' member of
Router.



Modified: torctl/trunk/python/TorCtl/TorCtl.py
===================================================================
--- torctl/trunk/python/TorCtl/TorCtl.py	2009-06-08 04:48:04 UTC (rev 19657)
+++ torctl/trunk/python/TorCtl/TorCtl.py	2009-06-08 05:04:49 UTC (rev 19658)
@@ -53,7 +53,7 @@
           ORCONN="ORCONN",
           STREAM_BW="STREAM_BW",
           BW="BW",
-		  NS="NS",
+          NS="NS",
           NEWCONSENSUS="NEWCONSENSUS",
           NEWDESC="NEWDESC",
           ADDRMAP="ADDRMAP",
@@ -296,8 +296,7 @@
     self.os = os
     self.list_rank = 0 # position in a sorted list of routers.
     self.uptime = uptime
-    m = re.search(r"(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)", published)
-    self.published = datetime.datetime(*map(int, m.groups()))
+    self.published = published
     self.refcount = 0 # How many open circs are we currently in?
     self.deleted = False # Has Tor already deleted this descriptor?
     self.contact = contact
@@ -362,7 +361,8 @@
       elif rt:
         router,ip = rt.groups()
       elif pb:
-        published = pb.group(1)
+        published = datetime.datetime.strptime(pb.group(1)+" UTC",
+                                "20%y-%m-%d %H:%M:%S %Z")
       elif ct:
         contact = ct.group(1)
     if router != ns.nickname:



More information about the tor-commits mailing list