Add timezone support to timestamp calculation

Update timestamp handling to include timezone information.
This commit is contained in:
Andy Low
2025-12-14 23:51:35 -05:00
committed by James Woglom
parent aea3f6bd6b
commit 1f1e755503
@@ -3,6 +3,7 @@ import arrow
from ...features import DEFAULT_FEATURES from ...features import DEFAULT_FEATURES
from ... import features from ... import features
from ...secret import TIMEZONE_NAME
from ...eventparser.generic import Events, decode_raw_events, EVENT_LEN from ...eventparser.generic import Events, decode_raw_events, EVENT_LEN
from ...eventparser.utils import bitmask_to_list from ...eventparser.utils import bitmask_to_list
from ...eventparser.raw_event import TANDEM_EPOCH from ...eventparser.raw_event import TANDEM_EPOCH
@@ -66,7 +67,7 @@ class ProcessCGMReading:
def timestamp_for(self, event): def timestamp_for(self, event):
# For backfills the time the event was added to the pump's event store # For backfills the time the event was added to the pump's event store
# might not be the time it actually occurred, so we use the egvTimestamp # might not be the time it actually occurred, so we use the egvTimestamp
return arrow.get(TANDEM_EPOCH + event.egvTimestamp) return arrow.get(TANDEM_EPOCH + event.egvTimestamp, tzinfo='UTC').replace(tzinfo=TIMEZONE_NAME)
def to_nsentry(self, event): def to_nsentry(self, event):
return NightscoutEntry.entry( return NightscoutEntry.entry(