Commit e0ec0ff6 authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix gnt-job list with empty timestamps

In case the job object doesn't have a timestamp (which is a separate
issue), the listing should not break. We fix this by changing the
FormatTimstamp function itself to return '?' in case the timestamp
doesn't look good (note that it still can break if non-integers are
returned, but this is unlikely).

Reviewed-by: imsnah
parent 1daae384
......@@ -703,5 +703,7 @@ def FormatTimestamp(ts):
@returns: a string with the formatted timestamp
"""
if not isinstance (ts, (tuple, list)) or len(ts) != 2:
return '?'
sec, usec = ts
return time.strftime("%F %T", time.localtime(sec)) + ".%06d" % usec
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment