Round values when determining netgraph output

This commit is contained in:
Stephen Seo 2022-10-19 11:11:24 +09:00
parent fb49271a7e
commit 4e8564b596
2 changed files with 4 additions and 1 deletions

View file

@ -6,6 +6,9 @@ Minor refactoring of how the netgraph string is handled.
Refactoring of handling of Option types wrapping primitive values. Refactoring of handling of Option types wrapping primitive values.
Round values when determining netgraph results instead of truncating to an
integer.
## 0.1.5 ## 0.1.5
Implemented `--netdev_width=<width>` which sets the minimum width of the netdev Implemented `--netdev_width=<width>` which sets the minimum width of the netdev

View file

@ -143,7 +143,7 @@ impl NetInfo {
let graph_value: u8 = if diff_max > graph_max { let graph_value: u8 = if diff_max > graph_max {
8 8
} else { } else {
(diff_max / graph_max * 8.0f64) as u8 (diff_max / graph_max * 8.0f64).round() as u8
}; };
self.graph.remove(0); self.graph.remove(0);