summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamian Johnson <atagar@torproject.org>2018-04-02 11:35:08 -0700
committerDamian Johnson <atagar@torproject.org>2018-04-02 11:39:02 -0700
commitf2bbbf74e144a635738e122631cf02c855c1246e (patch)
tree1d1140efe81592a93ccf0727a28c398647cacc0b
parent4de3324f12b0b8e28be77d69712fd7eb33b46d3d (diff)
Python3 stacktrace when dates are on a year boundary
Oops, python3 compatibility issue... https://trac.torproject.org/projects/tor/ticket/24820 >>> import time >>> time.mktime(list(time.strptime('2017', '%Y'))) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: Tuple or struct_time argument required As above, this needs to be swapped to a tuple. I'm a tad tempted to simply subtract 31536000 (the number of seconds in a year) from the unix timestamp instead, but on reflection there's leap years, leap seconds, and god knows what else so... meh.
-rw-r--r--nyx/log.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/nyx/log.py b/nyx/log.py
index 08a4878..37db680 100644
--- a/nyx/log.py
+++ b/nyx/log.py
@@ -494,7 +494,7 @@ def read_tor_log(path, read_limit = None):
if timestamp > time.time():
# log entry is from before a year boundary
timestamp_comp[0] -= 1
- timestamp = int(time.mktime(timestamp_comp))
+ timestamp = int(time.mktime(tuple(timestamp_comp)))
except ValueError:
raise ValueError("Log located at %s has a timestamp we don't recognize: %s" % (path, ' '.join(line_comp[:3])))