From: Stephen Seo Date: Wed, 19 Oct 2022 02:11:24 +0000 (+0900) Subject: Round values when determining netgraph output X-Git-Tag: 0.1.6~3 X-Git-Url: https://git.seodisparate.com/gitweb?a=commitdiff_plain;h=4e8564b5965a41d0e57752cb8b51e6c13d9a53e2;p=swaybar_info Round values when determining netgraph output --- diff --git a/Changelog.md b/Changelog.md index 241c1b0..80803e9 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,6 +6,9 @@ Minor refactoring of how the netgraph string is handled. Refactoring of handling of Option types wrapping primitive values. +Round values when determining netgraph results instead of truncating to an +integer. + ## 0.1.5 Implemented `--netdev_width=` which sets the minimum width of the netdev diff --git a/src/proc.rs b/src/proc.rs index 4dd5c14..69bb6e3 100644 --- a/src/proc.rs +++ b/src/proc.rs @@ -143,7 +143,7 @@ impl NetInfo { let graph_value: u8 = if diff_max > graph_max { 8 } else { - (diff_max / graph_max * 8.0f64) as u8 + (diff_max / graph_max * 8.0f64).round() as u8 }; self.graph.remove(0);