mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 12:14:36 +03:00
Make UptimeMeter cross-platform again.
This commit is contained in:
@ -20,6 +20,8 @@ in the source distribution for its full text.
|
||||
#include "ClockMeter.h"
|
||||
#include "HostnameMeter.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
/*{
|
||||
#include "Action.h"
|
||||
}*/
|
||||
@ -67,3 +69,12 @@ MeterClass* Platform_meterTypes[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
int Platform_getUptime() {
|
||||
double uptime = 0;
|
||||
FILE* fd = fopen(PROCDIR "/uptime", "r");
|
||||
if (fd) {
|
||||
fscanf(fd, "%64lf", &uptime);
|
||||
fclose(fd);
|
||||
}
|
||||
int totalseconds = (int) floor(uptime);
|
||||
}
|
||||
|
Reference in New Issue
Block a user