Skip to content
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

modify extract_seconds.py for python2.6 #93

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions scripts/extract_seconds.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ def extract_seconds(input_file, output_file):
start_datetime = extract_datetime_from_line(line, log_created_year)
if line.find('Iteration') != -1:
dt = extract_datetime_from_line(line, log_created_year)
elapsed_seconds = (dt - start_datetime).total_seconds()
#elapsed_seconds = (dt - start_datetime).total_seconds()
elapsed = dt - start_datetime
elapsed_seconds = (elapsed.microseconds + (elapsed.seconds + elapsed.days*24*3600) * 1e6) / 1e6
out.write('%f\n' % elapsed_seconds)
out.close()

if __name__ == '__main__':
if len(sys.argv) < 3:
print('Usage: ./extract_seconds input_file output_file')
exit(1)
extract_seconds(sys.argv[1], sys.argv[2])
extract_seconds(sys.argv[1], sys.argv[2])