Module: check_mk
Branch: master
Commit: f2deec5b7be7b3f46fcbd51d4e613043c571c7f7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f2deec5b7be7b3…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Mar 3 15:43:56 2016 +0100
human readable age: Using short units for saving space in graphs
---
web/htdocs/lib.py | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/web/htdocs/lib.py b/web/htdocs/lib.py
index 1b9d3f1..3725f19 100644
--- a/web/htdocs/lib.py
+++ b/web/htdocs/lib.py
@@ -642,31 +642,31 @@ def age_human_readable(secs, min_only=False):
return physical_precision(secs, 3, _("s"))
elif min_only:
mins = secs / 60.0
- return "%.1f %s" % (mins, _("min"))
+ return "%.1f %s" % (mins, _("m"))
elif secs < 10:
- return "%.2f %s" % (secs, _("sec"))
+ return "%.2f %s" % (secs, _("s"))
elif secs < 60:
- return "%.1f %s" % (secs, _("sec"))
+ return "%.1f %s" % (secs, _("s"))
elif secs < 240:
- return "%d %s" % (secs, _("sec"))
+ return "%d %s" % (secs, _("s"))
mins = secs / 60
if mins < 360:
- return "%d %s" % (mins, _("min"))
+ return "%d %s" % (mins, _("m"))
hours = mins / 60
if hours < 48:
- return "%d %s" % (hours, _("hours"))
+ return "%d %s" % (hours, _("h"))
days = hours / 24.0
if days < 6:
d = ("%.1f" % days).rstrip("0").rstrip(".")
- return "%s %s" % (d, _("days"))
+ return "%s %s" % (d, _("d"))
elif days < 999:
- return "%.0f %s" % (days, _("days"))
+ return "%.0f %s" % (days, _("d"))
else:
years = days / 365
if years < 10:
- return "%.1f %s" % (years, _("years"))
+ return "%.1f %s" % (years, _("y"))
else:
- return "%.0f %s" % (years, _("years"))
+ return "%.0f %s" % (years, _("y"))
def date_human_readable(timestamp):