Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 8 additions & 2 deletions can/interfaces/vector/canlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,14 @@ def __init__(

# Calculate time offset for absolute timestamps
offset = xlclass.XLuint64()
xldriver.xlGetSyncTime(self.port_handle, offset)
self._time_offset = time.time() - offset.value * 1e-9
try:
try:
xldriver.xlGetSyncTime(self.port_handle, offset)
except VectorError:
xldriver.xlGetChannelTime(self.port_handle, self.mask, offset)
self._time_offset = time.time() - offset.value * 1e-9
except VectorError:
self._time_offset = 0.0

self._is_filtered = False
super().__init__(channel=channel, can_filters=can_filters, **kwargs)
Expand Down
9 changes: 9 additions & 0 deletions can/interfaces/vector/xldriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ def check_status(result, function, arguments):
xlGetSyncTime.restype = xlclass.XLstatus
xlGetSyncTime.errcheck = check_status

xlGetChannelTime = _xlapi_dll.xlGetChannelTime
xlGetChannelTime.argtypes = [
xlclass.XLportHandle,
xlclass.XLaccess,
ctypes.POINTER(xlclass.XLuint64),
]
xlGetChannelTime.restype = xlclass.XLstatus
xlGetChannelTime.errcheck = check_status

xlClosePort = _xlapi_dll.xlClosePort
xlClosePort.argtypes = [xlclass.XLportHandle]
xlClosePort.restype = xlclass.XLstatus
Expand Down