diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2013-12-30 17:34:49 +0100 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2013-12-30 17:34:49 +0100 |
commit | e8f9e881d37536954f24d73b29cbccf86341c3d3 (patch) | |
tree | d01a8a28414a914769b1cf3845a7ea2382800605 | |
parent | 79fcef645f2448a4ba920c8ccfede43ef17e873b (diff) | |
download | xmobar-e8f9e881d37536954f24d73b29cbccf86341c3d3.tar.gz xmobar-e8f9e881d37536954f24d73b29cbccf86341c3d3.tar.bz2 |
Fix for time estimation when using the previous workaround
-rw-r--r-- | src/Plugins/Monitors/Batt.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Plugins/Monitors/Batt.hs b/src/Plugins/Monitors/Batt.hs index 1d168af..c6e140e 100644 --- a/src/Plugins/Monitors/Batt.hs +++ b/src/Plugins/Monitors/Batt.hs @@ -131,10 +131,10 @@ readBattery sc files = do a <- grab $ fFull files b <- grab $ fNow files d <- grab $ fCurrent files - let d' = if isCurrent files then d * 10 else d - return $ Battery (3600 * a / sc) -- wattseconds - (3600 * b / sc) -- wattseconds - (d' / sc) -- watts + let sc' = if isCurrent files then sc / 10 else sc + return $ Battery (3600 * a / sc') -- wattseconds + (3600 * b / sc') -- wattseconds + (d / sc') -- watts where grab f = handle onError $ withFile f ReadMode (fmap read . hGetLine) onError = const (return (-1)) :: SomeException -> IO Float |