diff --git a/can/interfaces/vector/canlib.py b/can/interfaces/vector/canlib.py index ed366b4c8..cb1858062 100644 --- a/can/interfaces/vector/canlib.py +++ b/can/interfaces/vector/canlib.py @@ -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) diff --git a/can/interfaces/vector/xldriver.py b/can/interfaces/vector/xldriver.py index 9bb1a1083..337135755 100644 --- a/can/interfaces/vector/xldriver.py +++ b/can/interfaces/vector/xldriver.py @@ -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