mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-24 22:06:14 +01:00
Don't use gmtime for a time difference
The gmtime function is intended to be used for calendar time.
This commit is contained in:
parent
7896937f50
commit
71297e31f4
12
osc/core.py
12
osc/core.py
@ -5772,13 +5772,13 @@ def print_jobhistory(apiurl, prj, current_package, repository, arch, format = 't
|
||||
st = int(node.get('starttime'))
|
||||
et = int(node.get('endtime'))
|
||||
endtime = time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(et))
|
||||
waittm = time.gmtime(et-st)
|
||||
if waittm.tm_mday > 1:
|
||||
waitbuild = "%1dd %2dh %2dm %2ds" % (waittm.tm_mday-1, waittm.tm_hour, waittm.tm_min, waittm.tm_sec)
|
||||
elif waittm.tm_hour:
|
||||
waitbuild = " %2dh %2dm %2ds" % (waittm.tm_hour, waittm.tm_min, waittm.tm_sec)
|
||||
waittm = et-st
|
||||
if waittm > 24*60*60:
|
||||
waitbuild = "%1dd %2dh %2dm %2ds" % (waittm / (24*60*60), (waittm / (60*60)) % 24, (waittm / 60) % 60, waittm % 60)
|
||||
elif waittm > 60*60:
|
||||
waitbuild = " %2dh %2dm %2ds" % (waittm / (60*60), (waittm / 60) % 60, waittm % 60)
|
||||
else:
|
||||
waitbuild = " %2dm %2ds" % (waittm.tm_min, waittm.tm_sec)
|
||||
waitbuild = " %2dm %2ds" % (waittm / 60, waittm % 60)
|
||||
|
||||
if format == 'csv':
|
||||
print('%s|%s|%s|%s|%s|%s' % (endtime, package, reason, code, waitbuild, worker))
|
||||
|
Loading…
Reference in New Issue
Block a user