comparison contrib/sawmill/web/templates/details.html @ 493:e075ce66e085

sawmill: fixed stupid time calc bug
author Sascha Teichmann <teichmann@intevation.de>
date Sat, 02 Oct 2010 10:09:05 +0000
parents 73a2e603a23b
children
comparison
equal deleted inserted replaced
492:93d66243bce7 493:e075ce66e085
32 def pretty_timedelta(a, b): 32 def pretty_timedelta(a, b):
33 if a is None or b is None: return "&lt;unknown&gt;" 33 if a is None or b is None: return "&lt;unknown&gt;"
34 td = a - b 34 td = a - b
35 secs = td.days * 24*3600 + td.seconds 35 secs = td.days * 24*3600 + td.seconds
36 out = [] 36 out = []
37 if secs > 3600: 37 if secs >= 3600:
38 hs = secs // 3600 38 hs = secs // 3600
39 out.append("%dh" % hs) 39 out.append("%dh" % hs)
40 secs %= 3600 40 secs %= 3600
41 if secs > 60: 41 if secs >= 60:
42 ms = secs // 60 42 ms = secs // 60
43 out.append("%dm" % ms) 43 out.append("%dm" % ms)
44 secs %= 60 44 secs %= 60
45 if secs > 0 or not out: 45 if secs > 0 or not out:
46 out.append("%ds" % secs) 46 out.append("%ds" % secs)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)