Skip to content

Commit

Permalink
Data type of parsed time and date changed. Closes #5
Browse files Browse the repository at this point in the history
  • Loading branch information
o3bvv committed Oct 29, 2013
1 parent d68c5f6 commit 18c7480
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 59 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='il2ds-log-parser',
version='0.9.0',
version='0.9.1',
description='Parser of IL-2 FB Dedicated Server events log.',
license='BSD License',
url='https://github.com/IL2HorusTeam/il2ds-log-parser',
Expand Down
8 changes: 6 additions & 2 deletions src/il2ds_log_parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
def parse_time(value):
"""Take time in '%I:%M:%S %p' format and convert it to ISO format."""
dt = datetime.datetime.strptime(value, LOG_TIME_FORMAT)
return dt.time().isoformat()
return dt.time()


def parse_date(value):
"""Take date in '%b %d, %Y' format and convert it to ISO format."""
dt = datetime.datetime.strptime(value, LOG_DATE_FORMAT)
return dt.date().isoformat()
return dt.date()


class TimeStampedRegexParser(object):
Expand Down Expand Up @@ -762,6 +762,10 @@ def end_mission(time):
if evt is None:
unparsed.append(line)
continue
if 'time' in evt:
evt['time'] = evt['time'].isoformat()
if 'date' in evt:
evt['date'] = evt['date'].isoformat()
if evt['type'] == EVT_MISSION_PLAYING:
if mission:
end_mission(evt['time'])
Expand Down

0 comments on commit 18c7480

Please sign in to comment.