From 22680a11ae2a3061c57123bc6afac2f11b7b51a7 Mon Sep 17 00:00:00 2001 From: Will Norris Date: Fri, 7 Apr 2023 16:42:21 -0700 Subject: [PATCH] net/sockstats: return early if no radio period length Signed-off-by: Will Norris --- net/sockstats/sockstats_tsgo.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/sockstats/sockstats_tsgo.go b/net/sockstats/sockstats_tsgo.go index a75e3f316..ffbcda964 100644 --- a/net/sockstats/sockstats_tsgo.go +++ b/net/sockstats/sockstats_tsgo.go @@ -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