Skip to content

Commit

Permalink
fix: remove presumptious fix and datestamp derivative
Browse files Browse the repository at this point in the history
  • Loading branch information
kamiccolo committed Mar 29, 2024
1 parent ea78e8c commit 9573dd2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
15 changes: 0 additions & 15 deletions pynmea2/types/proprietary/tnl.py
Expand Up @@ -210,18 +210,3 @@ class TNLEVT(TNL, DatetimeFix):
('GPS Day of the Week', 'gps_day_num', int),
('Leap Seconds', 'leap_secs', int)
)

# We can derive the date from GPS Week Number and Day of the Week
# Presumingly 1024 overflow was taken into accound by the GPS unit
# Taking into account that the GPS day could have overflown during
# leap seconds, if 0 <= UTC timestamp < leap seconds
@property
def datestamp(self):
gps_epoch = datetime.date(year=1980, month=1, day=6)
gps_week_day_delta = datetime.timedelta(weeks=self.gps_week_num, days=self.gps_day_num)
utc_time_delta = datetime.timedelta(
hours=self.timestamp.hour, minutes=self.timestamp.minute,
seconds=self.timestamp.second)
utc_leap_delta = datetime.timedelta(seconds=self.leap_secs)

return gps_epoch + gps_week_day_delta + utc_time_delta - utc_leap_delta
4 changes: 0 additions & 4 deletions test/test_tnl.py
Expand Up @@ -120,7 +120,3 @@ def test_tnlevt():
assert msg.gps_week_num == 2181
assert msg.gps_day_num == 5
assert msg.leap_secs == 18

assert msg.datestamp == datetime.date(2021, 10, 29)
assert msg.datetime == datetime.datetime(
2021, 10, 29, 13, 10, 7, 999785, tzinfo=datetime.timezone.utc)

0 comments on commit 9573dd2

Please sign in to comment.