aboutsummaryrefslogtreecommitdiffstats
path: root/UptimeMeter.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2016-04-11 13:01:08 +0200
committerDaniel Lange <DLange@git.local>2016-04-11 13:01:08 +0200
commit0063095c92e95190a0376ad245509345e5b690ed (patch)
tree0b8b7f9aac6410df323a3953423e7a1bdd121e1b /UptimeMeter.c
parent43997d37137cc1e4a1a5be654aa16d4992045e34 (diff)
parentff9409b1737627857eb47f64f536a3f66b6a09a4 (diff)
downloaddebian_htop-0063095c92e95190a0376ad245509345e5b690ed.tar.gz
debian_htop-0063095c92e95190a0376ad245509345e5b690ed.tar.bz2
debian_htop-0063095c92e95190a0376ad245509345e5b690ed.zip
Merge tag 'upstream/2.0.0'
Upstream version 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