]> git.seodisparate.com - swaybar_info/commitdiff
Round values when determining netgraph output
authorStephen Seo <seo.disparate@gmail.com>
Wed, 19 Oct 2022 02:11:24 +0000 (11:11 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Wed, 19 Oct 2022 02:11:24 +0000 (11:11 +0900)
Changelog.md
src/proc.rs

index 241c1b09dab058b9b2a372072fa1a49f789538d7..80803e97d88c82b3706b259d25ed716fe101f4db 100644 (file)
@@ -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=<width>` which sets the minimum width of the netdev
index 4dd5c1489d57d6e57b033003ef820dd98eb8f8ca..69bb6e3c8ae6d7edb37ce62850de8d8ea2f625da 100644 (file)
@@ -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);