Skip to content
Open
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: 3 additions & 3 deletions can/interfaces/vector/canlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ def _apply_filters(self, filters: CanFilters | None) -> None:
LOG.warning("Could not reset filters: %s", exc)

def _recv_internal(self, timeout: float | None) -> tuple[Message | None, bool]:
end_time = time.time() + timeout if timeout is not None else None
end_time = time.perf_counter() + timeout if timeout is not None else None

while True:
try:
Expand All @@ -721,15 +721,15 @@ def _recv_internal(self, timeout: float | None) -> tuple[Message | None, bool]:
return msg, self._is_filtered

# if no message was received, wait or return on timeout
if end_time is not None and time.time() > end_time:
if end_time is not None and time.perf_counter() > end_time:
return None, self._is_filtered

if HAS_EVENTS:
# Wait for receive event to occur
if end_time is None:
time_left_ms = INFINITE
else:
time_left = end_time - time.time()
time_left = end_time - time.perf_counter()
time_left_ms = max(0, int(time_left * 1000))
WaitForSingleObject(self.event_handle.value, time_left_ms) # type: ignore
else:
Expand Down
Loading