mirror of
https://github.com/bckelley/tconnectsync.git
synced 2026-08-24 03:34:12 -05:00
fix TypeError: can't compare offset-naive and offset-aware datetimes
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import logging
|
import logging
|
||||||
import collections
|
import collections
|
||||||
|
import arrow
|
||||||
|
|
||||||
from ...features import DEVICE_STATUS, DEFAULT_FEATURES
|
from ...features import DEVICE_STATUS, DEFAULT_FEATURES
|
||||||
from ...eventparser import events as eventtypes
|
from ...eventparser import events as eventtypes
|
||||||
@@ -82,7 +83,9 @@ class ProcessTimeRange:
|
|||||||
if c.enabled():
|
if c.enabled():
|
||||||
logger.info("%s is enabled from features %s" % (clazz, self.features))
|
logger.info("%s is enabled from features %s" % (clazz, self.features))
|
||||||
# Cap events_last_time at time_end to handle pump clock drift
|
# Cap events_last_time at time_end to handle pump clock drift
|
||||||
capped_time_end = min(events_last_time, time_end) if events_last_time else time_end
|
# Ensure time_end is timezone-aware for comparison
|
||||||
|
time_end_aware = arrow.get(time_end)
|
||||||
|
capped_time_end = min(events_last_time, time_end_aware) if events_last_time else time_end_aware
|
||||||
ns_entries = c.process(events, events_first_time, capped_time_end)
|
ns_entries = c.process(events, events_first_time, capped_time_end)
|
||||||
w = c.write(ns_entries)
|
w = c.write(ns_entries)
|
||||||
if w:
|
if w:
|
||||||
|
|||||||
Reference in New Issue
Block a user