diff options
author | Arnavion <arnavion@gmail.com> | 2019-08-10 11:37:35 -0700 |
---|---|---|
committer | Arnavion <arnavion@gmail.com> | 2019-08-10 11:37:35 -0700 |
commit | 1acfb0a75223068c676e06967003fe989400e21d (patch) | |
tree | 147b8755eddd8c59962f7efe0c11c2f32aa5bb70 /linux | |
parent | 1d5e6a27a05ed44e6364a5b14c925503f8604a1f (diff) |
Show N/A instead of 0KHz when CPU frequency is not available.
Diffstat (limited to 'linux')
-rw-r--r-- | linux/Platform.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/linux/Platform.c b/linux/Platform.c index e92d0c51..fc81d3bf 100644 --- a/linux/Platform.c +++ b/linux/Platform.c @@ -193,10 +193,10 @@ double Platform_setCPUValues(Meter* this, int cpu) { percent = CLAMP(percent, 0.0, 100.0); if (isnan(percent)) percent = 0.0; - v[CPU_METER_FREQUENCY] = 0; + v[CPU_METER_FREQUENCY] = -1; if (this->pl->settings->showCPUFrequency) { - char filename[63+1]; - xSnprintf(filename, 63, "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_cur_freq", cpu - 1); + char filename[64]; + xSnprintf(filename, sizeof(filename), "/sys/devices/system/cpu/cpu%d/cpufreq/scaling_cur_freq", cpu - 1); FILE* fd = fopen(filename, "r"); if (fd) { unsigned int cpuFrequency; |