Skip to content

Commit 3a7c80e

Browse files
authored
Write 3 ms digits to ascii to resolve CANoe bug (#1362)
* Write 3 ms to ascii for CANoe and fix append error The ascii format currently is not setup to append. I recenly added in **options to the logger script. **options are only required for the rolling logger. * Black and mypy fixes * Revert "Write 3 ms to ascii for CANoe and fix append error" This reverts commit 57af021.
1 parent 9e795de commit 3a7c80e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

can/io/asc.py

+4
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,10 @@ def __init__(
372372

373373
# write start of file header
374374
now = datetime.now().strftime(self.FORMAT_START_OF_FILE_DATE)
375+
# Note: CANoe requires that the microsecond field only have 3 digits
376+
idx = now.index(".") # Find the index in the string of the decimal
377+
# Keep decimal and first three ms digits (4), remove remaining digits
378+
now = now.replace(now[idx + 4 : now[idx:].index(" ") + idx], "")
375379
self.file.write(f"date {now}\n")
376380
self.file.write("base hex timestamps absolute\n")
377381
self.file.write("internal events logged\n")

0 commit comments

Comments
 (0)