Make network stats start at zero

This commit is contained in:
Pedro Pombeiro 2018-01-29 17:43:37 +01:00
parent 5acfa9637f
commit 68b7cabb30
No known key found for this signature in database
GPG Key ID: A65DEB11E4BBC647
1 changed files with 4 additions and 2 deletions

6
ui.go
View File

@ -129,8 +129,10 @@ func (ui *UI) updateNetstats(sparklineIndex int, data []float64) {
direction = "Tx"
}
total := data[last]
current := total - data[last-1]
baseline := data[0]
total := data[last] - baseline
prev := data[last-1] - baseline
current := total - prev
if current > *max {
*max = current
}