Skip to content

Commit d54c2ca

Browse files
authored
Update blf.py
Adding comment
1 parent 0710466 commit d54c2ca

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

can/io/blf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,9 @@ def _add_object(self, obj_type, data, timestamp=None):
530530
if timestamp is None:
531531
timestamp = self.stop_timestamp or time.time()
532532
if self.start_timestamp is None:
533+
# Save start timestamp using the same precision as the BLF format
534+
# Truncating to milliseconds to avoid rounding errors when calculating
535+
# the timestamp difference
533536
self.start_timestamp = int(timestamp * 1000) / 1000
534537
self.stop_timestamp = timestamp
535538
timestamp = int((timestamp - self.start_timestamp) * 1e9)

0 commit comments

Comments
 (0)