aboutsummaryrefslogtreecommitdiffstats
path: root/UptimeMeter.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2016-04-11 13:01:07 +0200
committerDaniel Lange <DLange@git.local>2016-04-11 13:01:07 +0200
commitff9409b1737627857eb47f64f536a3f66b6a09a4 (patch)
tree61b631ba551e68a4f656b8b76ff7bd0d9955fc64 /UptimeMeter.c
parentf75ab6d2c11e8a8e18191b087564aedebbeb96c5 (diff)
downloaddebian_htop-ff9409b1737627857eb47f64f536a3f66b6a09a4.tar.gz
debian_htop-ff9409b1737627857eb47f64f536a3f66b6a09a4.tar.bz2
debian_htop-ff9409b1737627857eb47f64f536a3f66b6a09a4.zip
Imported Upstream version 2.0.0upstream/2.0.0
Diffstat (limited to 'UptimeMeter.c')
-rw-r--r--UptimeMeter.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/UptimeMeter.c b/UptimeMeter.c
index 9e28817..a033b17 100644
--- a/UptimeMeter.c
+++ b/UptimeMeter.c
@@ -6,12 +6,9 @@ in the source distribution for its full text.
*/
#include "UptimeMeter.h"
-
-#include "ProcessList.h"
+#include "Platform.h"
#include "CRT.h"
-#include <math.h>
-
/*{
#include "Meter.h"
}*/
@@ -21,13 +18,11 @@ int UptimeMeter_attributes[] = {
};
static void UptimeMeter_setValues(Meter* this, char* buffer, int len) {
- double uptime = 0;
- FILE* fd = fopen(PROCDIR "/uptime", "r");
- if (fd) {
- fscanf(fd, "%64lf", &uptime);
- fclose(fd);
+ int totalseconds = Platform_getUptime();
+ if (totalseconds == -1) {
+ snprintf(buffer, len, "(unknown)");
+ return;
}
- int totalseconds = (int) ceil(uptime);
int seconds = totalseconds % 60;
int minutes = (totalseconds/60) % 60;
int hours = (totalseconds/3600) % 24;

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