Skip to content

Commit e6094fa

Browse files
committed
util: fix hours and mins mixup
1 parent e2fff25 commit e6094fa

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

flow/util/genElapsedTime.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,13 @@
3636
# Ensure that hours, min and seconds are separated by ':' not '.'
3737
timePor = timePor.replace('.',':')
3838
# Calculate elapsed time that has this format 'h:m:s'
39-
timeList = timePor.split(':', 2)
40-
elapsedTime = int(timeList[0])*3600 + int(timeList[1])*60 + int(timeList[2])
39+
timeList = timePor.split(':')
40+
if len(timeList) == 2:
41+
# Only minutes and seconds are present
42+
elapsedTime = int(timeList[0])*60 + int(timeList[1])
43+
elif len(timeList) == 3:
44+
# Hours, minutes, and seconds are present
45+
elapsedTime = int(timeList[0])*3600 + int(timeList[1])*60 + int(timeList[2])
4146

4247
# Print the name of the step and the corresponding elapsed time
4348
print('%-25s %10s' % (os.path.splitext(os.path.basename(str(f)))[0], elapsedTime))

0 commit comments

Comments
 (0)