Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion can/interfaces/ics_neovi/neovi_bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import os
import tempfile
from collections import Counter, defaultdict, deque
from datetime import datetime
from functools import partial
from itertools import cycle
from threading import Event
Expand Down Expand Up @@ -68,6 +69,9 @@ def __exit__(self, exc_type, exc_val, exc_tb):
open_lock = FileLock(os.path.join(tempfile.gettempdir(), "neovi.lock"))
description_id = cycle(range(1, 0x8000))

ICS_EPOCH = datetime.fromisoformat("2007-01-01")
ICS_EPOCH_DELTA = (ICS_EPOCH - datetime.fromisoformat("1970-01-01")).total_seconds()


class ICSApiError(CanError):
"""
Expand Down Expand Up @@ -384,7 +388,7 @@ def _get_timestamp_for_msg(self, ics_msg):
return ics_msg.TimeSystem
else:
# This is the hardware time stamp.
return ics.get_timestamp_for_msg(self.dev, ics_msg)
return ics.get_timestamp_for_msg(self.dev, ics_msg) + ICS_EPOCH_DELTA

def _ics_msg_to_message(self, ics_msg):
is_fd = ics_msg.Protocol == ics.SPY_PROTOCOL_CANFD
Expand Down