Extend time unit to years

This commit is contained in:
Peter J. Holzer 2022-12-27 11:10:06 +01:00 committed by Peter J. Holzer
parent 74c6a19302
commit 0fab037cbc
1 changed files with 4 additions and 1 deletions

View File

@ -127,7 +127,10 @@ class Gauge(Widget):
unit = self.lts.description["unit"]
log.debug("unit = %s", unit)
if unit == "s":
if value >= 86400:
if value >= 365.25 * 86400:
value /= 365.25 * 86400
unit = "years"
elif value >= 86400:
value /= 86400
unit = "days"
elif value >= 3600: