net/sockstats: return early if no radio period length

Signed-off-by: Will Norris <will@tailscale.com>
This commit is contained in:
Will Norris 2023-04-07 16:42:21 -07:00 committed by Will Norris
parent 75784e10e2
commit 22680a11ae

View File

@ -332,6 +332,9 @@ func (rm *radioMonitor) radioHighPercent() int64 {
now := rm.now().Unix()
var periodLength int64 = radioSampleSize
if t := now - rm.startTime; t < periodLength {
if t <= 0 {
return 0
}
periodLength = t
}
periodStart := now - periodLength // start of current reporting period