diff options
| author | Damian Johnson <atagar@torproject.org> | 2018-04-02 11:35:08 -0700 |
|---|---|---|
| committer | Damian Johnson <atagar@torproject.org> | 2018-04-02 11:39:02 -0700 |
| commit | f2bbbf74e144a635738e122631cf02c855c1246e (patch) | |
| tree | 1d1140efe81592a93ccf0727a28c398647cacc0b | |
| parent | 4de3324f12b0b8e28be77d69712fd7eb33b46d3d (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.py | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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]))) |
