1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-20 20:09:11 +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:
Marc Bonnici 2018-05-21 17:01:26 +01:00 committed by setrofim
parent f73f502ecd
commit 6cb7031713

View File

@ -247,7 +247,7 @@ def format_duration(seconds, sep=' ', order=['day', 'hour', 'minute', 'second'])
if isinstance(seconds, timedelta):
td = seconds
else:
td = timedelta(seconds=seconds)
td = timedelta(seconds=seconds or 0)
dt = datetime(1, 1, 1) + td
result = []
for item in order: