mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-14 21:14:35 +03:00
sanity checks
This commit is contained in:
@ -21,8 +21,10 @@ int UptimeMeter_attributes[] = {
|
||||
static void UptimeMeter_setValues(Meter* this, char* buffer, int len) {
|
||||
double uptime = 0;
|
||||
FILE* fd = fopen(PROCDIR "/uptime", "r");
|
||||
fscanf(fd, "%lf", &uptime);
|
||||
fclose(fd);
|
||||
if (fd) {
|
||||
fscanf(fd, "%lf", &uptime);
|
||||
fclose(fd);
|
||||
}
|
||||
int totalseconds = (int) ceil(uptime);
|
||||
int seconds = totalseconds % 60;
|
||||
int minutes = (totalseconds/60) % 60;
|
||||
|
Reference in New Issue
Block a user