Skip to content

Commit 5fb6023

Browse files
hardbytebessman
andauthored
Error handling in ASC time parsing
Co-authored-by: Alexander Bessman <bessman@users.noreply.github.com>
1 parent ef9360c commit 5fb6023

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎can/io/asc.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ def __iter__(self):
5555

5656
#check for timestamp
5757
if "begin triggerblock" in temp.lower():
58-
_, _, start_time = temp.split(None, 2)
58+
try:
59+
_, _, start_time = temp.split(None, 2)
60+
start_time = datetime.strptime(start_time, "%a %b %m %I:%M:%S.%f %p %Y").timestamp()
61+
except ValueError:
62+
start_time = 0.0
5963
start_time = datetime.strptime(start_time, "%a %b %m %I:%M:%S.%f %p %Y").timestamp()
6064
continue
6165

0 commit comments

Comments
 (0)