diff --git a/node/bwmonitor/bwmonitor.go b/node/bwmonitor/bwmonitor.go index baeeaff980522b685be131ba0db9632283e582cc..25f915be549ca7eb0e812e862a773fc024623ba9 100644 --- a/node/bwmonitor/bwmonitor.go +++ b/node/bwmonitor/bwmonitor.go @@ -68,9 +68,8 @@ func (bw *BandwidthMonitor) Run(stop chan bool) { t := time.NewTicker(bw.period) for { select { - case <-t.C: + case now := <-t.C: if c, err := getBytesSentForDevice(bw.device); err == nil { - now := time.Now() bw.lock.Lock() bw.rate = float64(c-bw.counter) / now.Sub(bw.stamp).Seconds() bw.counter = c