Skip to content

Commit

Permalink
set tzinfo (fix #100)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwoglom committed Oct 1, 2024
1 parent d9d1b8a commit 4af54bf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tconnectsync/eventparser/raw_event.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import struct
import arrow

from ..secret import TIMEZONE_NAME

from dataclasses import dataclass

EVENT_LEN = 26
Expand Down Expand Up @@ -29,7 +31,11 @@ def build(raw):
seqNum = seqNum,
raw = raw
)

@property
def timestamp(self):
return arrow.get(TANDEM_EPOCH + self.timestampRaw)
# Event timestamps do not have TZ data attached to them when parsed,
# but represent the user's time zone setting. So we keep the time
# referenced on them, but force the timezone to what the user
# requests via the TZ secret.
return arrow.get(TANDEM_EPOCH + self.timestampRaw, tzinfo=TIMEZONE_NAME)

0 comments on commit 4af54bf

Please sign in to comment.