[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r21887: {projects} Better fix for exonerator.py on Windows. (projects/archives/trunk/exonerator)
Author: kloesing
Date: 2010-03-09 10:16:41 +0000 (Tue, 09 Mar 2010)
New Revision: 21887
Modified:
projects/archives/trunk/exonerator/exonerator.py
Log:
Better fix for exonerator.py on Windows.
Modified: projects/archives/trunk/exonerator/exonerator.py
===================================================================
--- projects/archives/trunk/exonerator/exonerator.py 2010-03-09 08:27:12 UTC (rev 21886)
+++ projects/archives/trunk/exonerator/exonerator.py 2010-03-09 10:16:41 UTC (rev 21887)
@@ -5,6 +5,7 @@
import os
import sys
import time
+import calendar
from optparse import OptionParser
from IPy import IP
@@ -30,9 +31,9 @@
relayIP = IP(args[0])
except ValueError:
parser.error("invalid IP address in question: '%s'" % args[0])
- timestampStr = "%s %s UTC" % (args[1], args[2])
+ timestampStr = "%s %s" % (args[1], args[2])
try:
- timestamp = time.strptime(timestampStr, "%Y-%m-%d %H:%M:%S %Z")
+ timestamp = time.strptime(timestampStr + " UTC", "%Y-%m-%d %H:%M:%S %Z")
except ValueError:
parser.error("incorrect time format: '%s'" % timestampStr)
# if a target is given, parse address and possibly port part of it
@@ -67,9 +68,9 @@
DELIMITER)
# check that we have the required archives
- timestampTooOld = time.gmtime(time.mktime(timestamp) - 300 * 60)
- timestampFrom = time.gmtime(time.mktime(timestamp) - 180 * 60)
- timestampTooNew = time.gmtime(time.mktime(timestamp) + 120 * 60)
+ timestampTooOld = time.gmtime(calendar.timegm(timestamp) - 300 * 60)
+ timestampFrom = time.gmtime(calendar.timegm(timestamp) - 180 * 60)
+ timestampTooNew = time.gmtime(calendar.timegm(timestamp) + 120 * 60)
timestampTooOldStr = time.strftime("%Y-%m-%d %H:%M:%S",
timestampTooOld)
timestampFromStr = time.strftime("%Y-%m-%d %H:%M:%S", timestampFrom)