From 5d719b4cde41e27c28b8c6342ccc40d97af04370 Mon Sep 17 00:00:00 2001 From: Jose A Ortega Ruiz Date: Thu, 11 Feb 2010 01:38:57 +0100 Subject: First stab at top monitors Ignore-this: c89a13a99236d416cba2ba285099a2d7 darcs-hash:20100211003857-748be-76b55377cc1c2793711bc4003619dd366af0aa5c.gz --- Plugins/Monitors/Common.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Plugins/Monitors/Common.hs') diff --git a/Plugins/Monitors/Common.hs b/Plugins/Monitors/Common.hs index a102036..6729397 100644 --- a/Plugins/Monitors/Common.hs +++ b/Plugins/Monitors/Common.hs @@ -35,6 +35,7 @@ module Plugins.Monitors.Common ( , parseTemplate -- ** String Manipulation -- $strings + , padString , showWithColors , showWithColors' , showPercentsWithColors @@ -296,7 +297,7 @@ showDigits d n = showWithUnits :: Int -> Int -> Float -> String showWithUnits d n x | x < 0 = "-" ++ showWithUnits d n (-x) - | n > 3 || x < 10^d = show (round x :: Int) ++ units n + | n > 3 || x < 10^(d + 1) = show (round x :: Int) ++ units n | x <= 1024 = showDigits d (x/1024) ++ units (n+1) | otherwise = showWithUnits d (n+1) (x/1024) where units = (!!) ["B", "K", "M", "G", "T"] -- cgit v1.2.3