Skip to content

Commit e50b709

Browse files
committed
use hardware timestamp if available in candle_bus
1 parent f1bc432 commit e50b709

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

candle/candle_bus.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def __init__(self, channel: Union[int, str], can_filters: Optional[CanFilters] =
4343

4444
# Get the channel.
4545
self._channel = self._device[self._channel_number]
46+
self._hardware_timestamp = self._channel.feature.hardware_timestamp
4647
self.channel_info = f'{self._device.serial_number}:{self._channel_number}'
4748

4849
# Reset channel.
@@ -141,9 +142,8 @@ def _recv_internal(
141142
pass
142143

143144
if frame is not None:
144-
timestamp = frame.timestamp if self._channel.feature.hardware_timestamp else time.monotonic()
145145
msg = can.Message(
146-
timestamp=timestamp,
146+
timestamp=frame.timestamp if self._hardware_timestamp else time.monotonic(),
147147
arbitration_id=frame.can_id,
148148
is_extended_id=frame.frame_type.extended_id,
149149
is_remote_frame=frame.frame_type.remote_frame,

0 commit comments

Comments
 (0)