make sure timestamp17(), which is part of warc name, always returns a 17 digit timestamp (even if millisecond part is <100)

This commit is contained in:
Noah Levitt 2015-07-17 13:30:52 -07:00
parent 8dfcf0401c
commit 67f2ceb717

View File

@ -160,7 +160,7 @@ class WarcWriter:
def timestamp17(self):
now = datetime.utcnow()
return '{}{}'.format(now.strftime('%Y%m%d%H%M%S'), now.microsecond//1000)
return '{:%Y%m%d%H%M%S}{:03d}'.format(now, now.microsecond//1000)
def close_writer(self):
if self._fpath: