isoFormat regexp matches month-date in the wrong order.
Also the microsecond multiplier (* 1000) does not seem to be necessary with iso format.
@@ -329,8 +329,8 @@
isoFormat = re.compile('''
^
(?P<year> \d{1,4})- # year
- (?P<date> \d{1,2})- # date
- (?P<month> \d{1,2}) # month
+ (?P<month> \d{1,2})- # month
+ (?P<date> \d{1,2}) # date
\s+
(?P<hour> \d{1,2}): # hour
(?P<minute> \d{1,2}): # minute
@@ -384,8 +384,10 @@
if format == 'cisco':
mstr = 'JanFebMarAprMayJunJulAugSepOctNovDec'
month = (mstr.find(matched.group('month')) + 3) / 3
+ microsec = int(matched.group('microsec')) * 1000
else:
month = int(matched.group('month'))
+ microsec = int(matched.group('microsec'))
# create new datetime class instance
parsedDatetime = datetime.datetime(
@@ -395,7 +397,7 @@
int(matched.group('hour')),
int(matched.group('minute')),
int(matched.group('second')),
- int(matched.group('microsec')) * 1000,
+ microsec,
None # set time zone to default - UTC. It is possible to substitute it later with appropiate tzinfo subclass
)