summaryrefslogtreecommitdiff
path: root/scripts/logreport.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/logreport.py')
-rw-r--r--scripts/logreport.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/logreport.py b/scripts/logreport.py
index 69b6e46..cdde7c7 100644
--- a/scripts/logreport.py
+++ b/scripts/logreport.py
@@ -326,6 +326,9 @@ def peek(iterable):
raise ValueError('cannot peek on empty iterator')
return first, itertools.chain([first], iterable)
+def total_seconds(td):
+ return td.seconds + td.days * 24 * 3600
+
def yield_log_windows(raw_iter, interval, parse_func, timekey):
wrapped_iter = itertools.ifilter(None, itertools.imap(parse_func, itertools.count(1), raw_iter))
@@ -334,7 +337,8 @@ def yield_log_windows(raw_iter, interval, parse_func, timekey):
start_time = first[timekey]
def keyfunc(record):
- return int((record[timekey] - start_time).seconds / interval.seconds)
+ diff = record[timekey] - start_time
+ return int(total_seconds(diff) / total_seconds(interval))
for i, g in itertools.groupby(wrapped_iter, keyfunc):
yield start_time + (interval * i), list(g)