diff options
Diffstat (limited to 'Plugins')
-rw-r--r-- | Plugins/Monitors/Common.hs | 5 | ||||
-rw-r--r-- | Plugins/Monitors/CpuFreq.hs | 7 |
2 files changed, 6 insertions, 6 deletions
diff --git a/Plugins/Monitors/Common.hs b/Plugins/Monitors/Common.hs index 9f1db3c..9a76be5 100644 --- a/Plugins/Monitors/Common.hs +++ b/Plugins/Monitors/Common.hs @@ -317,9 +317,8 @@ takeDigits d n = fromIntegral (round (n * fact) :: Int) / fact where fact = 10 ^ d -showDigits :: Int -> Float -> String -showDigits d n = - showFFloat (Just d) n "" +showDigits :: (RealFloat a) => Int -> a -> String +showDigits d n = showFFloat (Just d) n "" showWithUnits :: Int -> Int -> Float -> String showWithUnits d n x diff --git a/Plugins/Monitors/CpuFreq.hs b/Plugins/Monitors/CpuFreq.hs index fd1da4c..4f01922 100644 --- a/Plugins/Monitors/CpuFreq.hs +++ b/Plugins/Monitors/CpuFreq.hs @@ -28,7 +28,8 @@ cpuFreqConfig = mkMConfig -- replacements -- | --- Function retrieves monitor string holding the cpu frequency (or frequencies) +-- Function retrieves monitor string holding the cpu frequency (or +-- frequencies) runCpuFreq :: [String] -> Monitor String runCpuFreq _ = do let dir = "/sys/devices/system/cpu" @@ -36,7 +37,7 @@ runCpuFreq _ = do pattern = "cpu" divisor = 1e6 :: Double failureMessage = "CpuFreq: N/A" - fmt x | x < 1 = (show (round (x * 1000) :: Integer)) ++ "MHz" - | otherwise = (show x) ++ "GHz" + fmt x | x < 1 = show (round (x * 1000) :: Integer) ++ "MHz" + | otherwise = showDigits 1 x ++ "GHz" checkedDataRetrieval failureMessage dir file pattern (/divisor) fmt |