mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-02-21 20:38:57 +00:00
wa/misc: Fix format_duration() to handle missing time
If a run is interrupted this can cause the time to be `None` causing an error, if this is the case then set time to 0 and therefore return `N/A`.
This commit is contained in:
parent
f73f502ecd
commit
6cb7031713
@ -247,7 +247,7 @@ def format_duration(seconds, sep=' ', order=['day', 'hour', 'minute', 'second'])
|
|||||||
if isinstance(seconds, timedelta):
|
if isinstance(seconds, timedelta):
|
||||||
td = seconds
|
td = seconds
|
||||||
else:
|
else:
|
||||||
td = timedelta(seconds=seconds)
|
td = timedelta(seconds=seconds or 0)
|
||||||
dt = datetime(1, 1, 1) + td
|
dt = datetime(1, 1, 1) + td
|
||||||
result = []
|
result = []
|
||||||
for item in order:
|
for item in order:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user