From c2a493e8b26f39d0d7022b3caacdd6808a975419 Mon Sep 17 00:00:00 2001
From: Ada Joule <ada.fulmina@gmail.com>
Date: Sat, 3 Feb 2018 23:28:02 +0700
Subject: Change default unit to GHz

---
 src/Plugins/Monitors/CpuFreq.hs | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'src')

diff --git a/src/Plugins/Monitors/CpuFreq.hs b/src/Plugins/Monitors/CpuFreq.hs
index b5ee461..7e615a6 100644
--- a/src/Plugins/Monitors/CpuFreq.hs
+++ b/src/Plugins/Monitors/CpuFreq.hs
@@ -35,9 +35,10 @@ runCpuFreq _ = do
   ddigits <- getConfigValue decDigits
   let path = ["/sys/devices/system/cpu/cpu", "/cpufreq/scaling_cur_freq"]
       divisor = 1e6 :: Double
-      fmt x | x < 1 = mhzFmt x ++
-                      if suffix then "MHz" else ""
-            | otherwise = if suffix then showDigits ddigits x ++ "GHz" else mhzFmt x
+      fmt x | x < 1 = if suffix then mhzFmt x ++ "MHz"
+                                else ghzFmt x
+            | otherwise = ghzFmt x ++ if suffix then "GHz" else ""
       mhzFmt x = show (round (x * 1000) :: Integer)
+      ghzFmt x = showDigits ddigits x
   failureMessage <- getConfigValue naString
   checkedDataRetrieval failureMessage [path] Nothing (/divisor) fmt
-- 
cgit v1.2.3