summaryrefslogtreecommitdiffhomepage
path: root/src/Plugins/Kbd.hsc
diff options
context:
space:
mode:
authorTomas Janousek <tomi@nomi.cz>2017-01-23 14:40:20 +0100
committerTomas Janousek <tomi@nomi.cz>2017-01-23 14:53:43 +0100
commit94b74da9de8d79d74769c7937ef9c969d89ba42f (patch)
treec9b35cc193ed2fa8c81dd03fb1bfb8a0a9b22624 /src/Plugins/Kbd.hsc
parent9caa2668a0f32af600f0d5183058477b00ff977f (diff)
downloadxmobar-94b74da9de8d79d74769c7937ef9c969d89ba42f.tar.gz
xmobar-94b74da9de8d79d74769c7937ef9c969d89ba42f.tar.bz2
Fix Net monitor for large uptimes/bytecounts
My laptop currently has rx/tx bytes in 10s of gigabytes and it's only been up for 20 days. Normally it's several times more. At this point, Float can only tell the difference of 4KB and up: Prelude> let x = (50 * 2^30 :: Float) in (x + 2000) - x 0.0 Prelude> let x = (50 * 2^30 :: Float) in (x + 3000) - x 4096.0 This commit makes the Net monitor read Word64 which is exactly what the kernel prints into /proc/net/dev [1] and converts to Float only after subtracting the two numbers. [1] https://github.com/torvalds/linux/blob/7a308bb3016f57e5be11a677d15b821536419d36/net/core/net-procfs.c#L82 Still, I think it's time to switch from Float to Double. At half-gigabit speeds (easily attainable at home while rsyncing over a direct UTP cable between two post-2010 laptops), Float can only tell the difference of 8 bytes and up (and I'm not even considering takeDigits!). That's probably okay for a Net monitor in xmobar, but we're so close to the limit it makes sense to move to Double just in case.
Diffstat (limited to 'src/Plugins/Kbd.hsc')
0 files changed, 0 insertions, 0 deletions