summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/Plugins/Monitors/CpuFreq.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Plugins/Monitors/CpuFreq.hs b/src/Plugins/Monitors/CpuFreq.hs
index e6ce07d..b5ee461 100644
--- a/src/Plugins/Monitors/CpuFreq.hs
+++ b/src/Plugins/Monitors/CpuFreq.hs
@@ -35,8 +35,9 @@ runCpuFreq _ = do
ddigits <- getConfigValue decDigits
let path = ["/sys/devices/system/cpu/cpu", "/cpufreq/scaling_cur_freq"]
divisor = 1e6 :: Double
- fmt x | x < 1 = show (round (x * 1000) :: Integer) ++
+ fmt x | x < 1 = mhzFmt x ++
if suffix then "MHz" else ""
- | otherwise = showDigits ddigits x ++ if suffix then "GHz" else ""
+ | otherwise = if suffix then showDigits ddigits x ++ "GHz" else mhzFmt x
+ mhzFmt x = show (round (x * 1000) :: Integer)
failureMessage <- getConfigValue naString
checkedDataRetrieval failureMessage [path] Nothing (/divisor) fmt