Author: justi9
Date: 2008-04-15 11:27:46 -0400 (Tue, 15 Apr 2008)
New Revision: 1913
Modified:
mgmt/cumin/python/cumin/formats.py
Log:
Simplify and fix duration formatters
Modified: mgmt/cumin/python/cumin/formats.py
===================================================================
--- mgmt/cumin/python/cumin/formats.py 2008-04-15 15:10:04 UTC (rev 1912)
+++ mgmt/cumin/python/cumin/formats.py 2008-04-15 15:27:46 UTC (rev 1913)
@@ -25,12 +25,12 @@
units = ("day", "hour", "min", "sec")
for period, unit in zip(periods, units):
- if secs > period:
+ if secs >= period:
count = secs // period
elems.append("%i %s%s" % (count, unit, ess(count)))
if len(elems) == 2:
- return ", ".join(elems) + sign
+ break
secs = secs % period
@@ -47,12 +47,12 @@
units = ("d", "h", "m", "s")
for period, unit in zip(periods, units):
- if secs > period:
+ if secs >= period:
count = secs // period
elems.append("%i%s" % (count, unit))
if len(elems) == 2:
- return sign + "".join(elems)
+ break
secs = secs % period
Show replies by date