Skip to content

Commit 1a69c54

Browse files
committed
Enable non-percent graph for Uptime meter
Also change one behavior, that in Bar or Graph mode, Uptime meter will now draw fractions of days. (Not a useful tweak though. :) ) Signed-off-by: Kang-Che Sung <[email protected]>
1 parent c0e4f0d commit 1a69c54

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

UptimeMeter.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ static void UptimeMeter_updateValues(Meter* this) {
2727
int minutes = (totalseconds / 60) % 60;
2828
int hours = (totalseconds / 3600) % 24;
2929
int days = (totalseconds / 86400);
30-
this->values[0] = days;
31-
if (days > this->total) {
32-
this->total = days;
33-
}
30+
this->values[0] = (double)totalseconds / 86400.0;
3431
char daysbuf[32];
3532
if (days > 100) {
3633
xSnprintf(daysbuf, sizeof(daysbuf), "%d days(!), ", days);
@@ -52,7 +49,7 @@ const MeterClass UptimeMeter_class = {
5249
.updateValues = UptimeMeter_updateValues,
5350
.defaultMode = TEXT_METERMODE,
5451
.maxItems = 1,
55-
.total = 100.0,
52+
.total = -1.0,
5653
.attributes = UptimeMeter_attributes,
5754
.name = "Uptime",
5855
.uiName = "Uptime",

0 commit comments

Comments
 (0)