-
-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for time as timestamp #21
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would appreciate a small example log file using this format, for tests. Something on the order of 5-10 lines, ideally containing regular messages, actions, joins/parts, maybe even a nick change.
Currently irclog2html has 100% test coverage and I do not wish to lose that. Would you be willing to try and write a unit test for your changes? If not, I'll see if I can find the time to do it myself.
src/irclog2html/irclog2html.py
Outdated
@@ -119,6 +120,7 @@ class LogParser(object): | |||
r'(?:\d{4}-\d{2}-\d{2}T|\d{2}-\w{3}-\d{4} |\w{3} \d{2} |\d{2} \w{3} )?' # Optional date | |||
r'\d\d:\d\d(:\d\d)?' # Mandatory HH:MM, optional :SS | |||
r')\]? +') # Optional ], mandatory space | |||
TIMESTAMP_REGEXP = re.compile(r'^(\d*) +') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be \d+
, to require at least one digit.
src/irclog2html/irclog2html.py
Outdated
if m: | ||
time = datetime.datetime.fromtimestamp( | ||
int(m.group(1))).isoformat() | ||
line = line[len(m.group(0)):] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Travis failure looks to be caused by timezones. Now I'm wondering if this should be utcfromtimestamp()
, or if I should change my test harness to set TZ=UTC
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed it makes sense to parse timestamp as UTC.
Thank you! |
I use the log from ii which switched to timestamp format for the log.