@@ -131,7 +131,7 @@ class ASCWriter(BaseIOHandler, Listener):
131131 """
132132
133133 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"
135135 FORMAT_EVENT = "{timestamp: 9.6f} {message}\n "
136136
137137 def __init__ (self , file , channel = 1 ):
@@ -146,7 +146,7 @@ def __init__(self, file, channel=1):
146146 self .channel = channel
147147
148148 # 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" )
150150 self .file .write ("date %s\n " % now )
151151 self .file .write ("base hex timestamps absolute\n " )
152152 self .file .write ("internal events logged\n " )
@@ -176,7 +176,8 @@ def log_event(self, message, timestamp=None):
176176 if not self .header_written :
177177 self .last_timestamp = (timestamp or 0.0 )
178178 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 ))
180181 self .file .write ("Begin Triggerblock %s\n " % formatted_date )
181182 self .header_written = True
182183 self .log_event ("Start of measurement" ) # caution: this is a recursive call!
0 commit comments