Skip to content

Commit 18c8341

Browse files
committed
znc-log-reader: fix comparing date-subclass vs datetime - no longer work in newer python
1 parent a3018a7 commit 18c8341

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

znc-log-reader

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,12 @@ def open_log_iterators(ctx, log_map, ts_a, ts_b):
263263
chan = chan_name(chan)
264264
for ts, p in reversed(sorted(files)): # newest-first
265265
# Discard all further way-too-old xz archives (should hold one month at most)
266-
if ts_a and (ts + dt.timedelta(63)) < ts_a:
266+
ts_dt = dt.datetime(ts.year, ts.month, ts.day)
267+
if ts_a and (ts_dt + dt.timedelta(63)) < ts_a:
267268
log.debug(f'Skipping too-old logs: {ts} - [ {rel_path(p)} ] and older')
268269
break
269270
# Skip way-too-new xz archives
270-
if ts_b and (ts - dt.timedelta(63)) > ts_b:
271+
if ts_b and (ts_dt - dt.timedelta(63)) > ts_b:
271272
log.debug(f'Skipping too-new logfile: {ts} [ {rel_path(p)} ]')
272273
continue
273274
# Create line-by-line iterators on file(s)

0 commit comments

Comments
 (0)