X-Git-Url: https://git.wpitchoune.net/gitweb/?p=psensor.git;a=blobdiff_plain;f=src%2Flib%2Fcpu.c;h=9fb389bbcfc7d10759a8542813b7eb9f2a8c2275;hp=ac70e39873410368bcc6c8ca16e640719d16e7e7;hb=49769174a8c907250359af42b7fc2680a1e660a3;hpb=f4a75ec81fc582c50a35eb2018c2da44150f6824 diff --git a/src/lib/cpu.c b/src/lib/cpu.c index ac70e39..9fb389b 100644 --- a/src/lib/cpu.c +++ b/src/lib/cpu.c @@ -64,7 +64,7 @@ static double get_usage() glibtop_cpu cpu; unsigned long int used; unsigned long int dt; - double cpu_rate = UNKNOWN_DBL_VALUE; + double cpu_rate; glibtop_get_cpu(&cpu); @@ -74,6 +74,8 @@ static double get_usage() if (dt) cpu_rate = 100 * (used - last_used) / dt; + else + cpu_rate = UNKNOWN_DBL_VALUE; last_used = used; last_total = cpu.total;