From 6e8850087cc766ca85958b4650971d7c74acaaca Mon Sep 17 00:00:00 2001 From: marschap Date: Thu, 30 Dec 2004 17:16:21 +0000 Subject: [PATCH] correct idle percentage for Linux --- clients/lcdproc/machine_Linux.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/clients/lcdproc/machine_Linux.c b/clients/lcdproc/machine_Linux.c index 2e53fea..d197ff2 100644 --- a/clients/lcdproc/machine_Linux.c +++ b/clients/lcdproc/machine_Linux.c @@ -497,8 +497,16 @@ int machine_get_smpload(load_type *result, int *numcpus) int machine_get_uptime(double *up, double *idle) { + double local_up, local_idle; + reread(uptime_fd, "get_uptime:"); - sscanf(procbuf, "%lf %lf", up, idle); + sscanf(procbuf, "%lf %lf", &local_up, &local_idle); + if (up != NULL) + *up = local_up; + if (idle != NULL) + *idle = (local_up != 0) + ? 100 * local_idle / local_up + : 100; return(TRUE); }