summaryrefslogtreecommitdiffstats
path: root/UptimeMeter.c
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2014-11-27 19:41:14 -0200
committerHisham Muhammad <hisham@gobolinux.org>2014-11-27 19:41:14 -0200
commitca03094bb2d60c6ee1558bd2bcfb9038244b38cb (patch)
treec2cecf055fb8c769b2e3c96f4153dc1a57a9e39d /UptimeMeter.c
parent2dcdd87658cdc38b2df5535cce85976e963fbd30 (diff)
Make UptimeMeter cross-platform again.
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 9e288171..a033b171 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