@@ -131,7 +131,7 @@ class ASCWriter(BaseIOHandler, Listener):
131
131
"""
132
132
133
133
FORMAT_MESSAGE = "{channel} {id:<15} Rx {dtype} {data}"
134
- FORMAT_DATE = "%a %b %m %I:%M:%S %p %Y"
134
+ FORMAT_DATE = "%a %b %m %I:%M:%S.{} %p %Y"
135
135
FORMAT_EVENT = "{timestamp: 9.6f} {message}\n "
136
136
137
137
def __init__ (self , file , channel = 1 ):
@@ -146,7 +146,7 @@ def __init__(self, file, channel=1):
146
146
self .channel = channel
147
147
148
148
# write start of file header
149
- now = datetime .now ().strftime ("%a %b %m %I:%M:%S %p %Y" )
149
+ now = datetime .now ().strftime ("%a %b %m %I:%M:%S.%f %p %Y" )
150
150
self .file .write ("date %s\n " % now )
151
151
self .file .write ("base hex timestamps absolute\n " )
152
152
self .file .write ("internal events logged\n " )
@@ -176,7 +176,8 @@ def log_event(self, message, timestamp=None):
176
176
if not self .header_written :
177
177
self .last_timestamp = (timestamp or 0.0 )
178
178
self .started = self .last_timestamp
179
- formatted_date = time .strftime (self .FORMAT_DATE , time .localtime (self .last_timestamp ))
179
+ mlsec = repr (self .last_timestamp ).split ('.' )[1 ][:3 ]
180
+ formatted_date = time .strftime (self .FORMAT_DATE .format (mlsec ), time .localtime (self .last_timestamp ))
180
181
self .file .write ("Begin Triggerblock %s\n " % formatted_date )
181
182
self .header_written = True
182
183
self .log_event ("Start of measurement" ) # caution: this is a recursive call!
0 commit comments