Skip to content

Commit b0273d9

Browse files
authored
Extract constant for start of file date format in ASCWriter (hardbyte#955)
1 parent 974d8a8 commit b0273d9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

can/io/asc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ class ASCWriter(BaseIOHandler, Listener):
246246
"{bit_timing_conf_ext_data:>8}",
247247
]
248248
)
249+
FORMAT_START_OF_FILE_DATE = "%a %b %d %I:%M:%S.%f %p %Y"
249250
FORMAT_DATE = "%a %b %d %I:%M:%S.{} %p %Y"
250251
FORMAT_EVENT = "{timestamp: 9.6f} {message}\n"
251252

@@ -268,7 +269,7 @@ def __init__(
268269
self.channel = channel
269270

270271
# write start of file header
271-
now = datetime.now().strftime("%a %b %d %I:%M:%S.%f %p %Y")
272+
now = datetime.now().strftime(self.FORMAT_START_OF_FILE_DATE)
272273
self.file.write("date %s\n" % now)
273274
self.file.write("base hex timestamps absolute\n")
274275
self.file.write("internal events logged\n")

0 commit comments

Comments
 (0)