1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-25 17:36:13 +01:00

- fix mismatch in given time, backend delivers always UTC unix time seconds

This commit is contained in:
Adrian Schröter 2015-02-17 10:26:04 +01:00
parent 453be845af
commit 4bd0436033
2 changed files with 11 additions and 11 deletions

2
NEWS
View File

@ -1,5 +1,5 @@
0.151
-
- fix times when data comes from OBS backend
0.150
- support local builds using builenv (for same build environment as a former build)

View File

@ -2885,11 +2885,11 @@ def shorttime(t):
"""
import time
if time.localtime()[0] == time.localtime(t)[0]:
if time.gmtime()[0] == time.gmtime(t)[0]:
# same year
return time.strftime('%b %d %H:%M', time.localtime(t))
return time.strftime('%b %d %H:%M %Z', time.gmtime(t))
else:
return time.strftime('%b %d %Y', time.localtime(t))
return time.strftime('%b %d %Y', time.gmtime(t))
def is_project_dir(d):
@ -5705,8 +5705,8 @@ def get_buildhistory(apiurl, prj, package, repository, arch, format = 'text'):
srcmd5 = node.get('srcmd5')
versrel = node.get('versrel')
bcnt = int(node.get('bcnt'))
t = time.localtime(int(node.get('time')))
t = time.strftime('%Y-%m-%d %H:%M:%S', t)
t = time.gmtime(int(node.get('time')))
t = time.strftime('%Y-%m-%d %H:%M:%S %Z', t)
if format == 'csv':
r.append('%s|%s|%s|%s.%d' % (t, srcmd5, rev, versrel, bcnt))
@ -5740,11 +5740,11 @@ def print_jobhistory(apiurl, prj, current_package, repository, arch, format = 't
reason = "unknown"
code = node.get('code')
rt = int(node.get('readytime'))
readyt = time.localtime(rt)
readyt = time.strftime('%Y-%m-%d %H:%M:%S', readyt)
readyt = time.gmtime(rt)
readyt = time.strftime('%Y-%m-%d %H:%M:%S %Z', readyt)
st = int(node.get('starttime'))
et = int(node.get('endtime'))
endtime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(et))
endtime = time.strftime('%Y-%m-%d %H:%M:%S %Z', 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)
@ -5805,8 +5805,8 @@ def get_commitlog(apiurl, prj, package, revision, format = 'text', meta = False,
requestid = node.find('requestid').text.encode(locale.getpreferredencoding(), 'replace')
except:
requestid = ""
t = time.localtime(int(node.find('time').text))
t = time.strftime('%Y-%m-%d %H:%M:%S', t)
t = time.gmtime(int(node.find('time').text))
t = time.strftime('%Y-%m-%d %H:%M:%S %Z', t)
if format == 'csv':
s = '%s|%s|%s|%s|%s|%s|%s' % (rev, user, t, srcmd5, version,