aboutsummaryrefslogtreecommitdiffstats
path: root/UptimeMeter.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2020-12-07 10:26:01 +0100
committerDaniel Lange <DLange@git.local>2020-12-07 10:26:01 +0100
commit65357c8c46154de4e4eca14075bfe5523bb5fc14 (patch)
tree8f430ee5a0d5de377c4e7c94e47842a27c70d7e8 /UptimeMeter.c
parentf80394a20254938142011855f2954b3f63fe5909 (diff)
downloaddebian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.tar.gz
debian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.tar.bz2
debian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.zip
New upstream version 3.0.3upstream/3.0.3
Diffstat (limited to 'UptimeMeter.c')
-rw-r--r--UptimeMeter.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/UptimeMeter.c b/UptimeMeter.c
index da1c9fd..37740c2 100644
--- a/UptimeMeter.c
+++ b/UptimeMeter.c
@@ -1,29 +1,32 @@
/*
htop - UptimeMeter.c
(C) 2004-2011 Hisham H. Muhammad
-Released under the GNU GPL, see the COPYING file
+Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
#include "UptimeMeter.h"
-#include "Platform.h"
+
#include "CRT.h"
+#include "Object.h"
+#include "Platform.h"
+#include "XUtils.h"
-int UptimeMeter_attributes[] = {
+static const int UptimeMeter_attributes[] = {
UPTIME
};
-static void UptimeMeter_updateValues(Meter* this, char* buffer, int len) {
+static void UptimeMeter_updateValues(Meter* this, char* buffer, size_t len) {
int totalseconds = Platform_getUptime();
if (totalseconds == -1) {
xSnprintf(buffer, len, "(unknown)");
return;
}
int seconds = totalseconds % 60;
- int minutes = (totalseconds/60) % 60;
- int hours = (totalseconds/3600) % 24;
- int days = (totalseconds/86400);
+ int minutes = (totalseconds / 60) % 60;
+ int hours = (totalseconds / 3600) % 24;
+ int days = (totalseconds / 86400);
this->values[0] = days;
if (days > this->total) {
this->total = days;
@@ -41,7 +44,7 @@ static void UptimeMeter_updateValues(Meter* this, char* buffer, int len) {
xSnprintf(buffer, len, "%s%02d:%02d:%02d", daysbuf, hours, minutes, seconds);
}
-MeterClass UptimeMeter_class = {
+const MeterClass UptimeMeter_class = {
.super = {
.extends = Class(Meter),
.delete = Meter_delete

© 2014-2024 Faster IT GmbH | imprint | privacy policy