Skip to content

Commit

Permalink
fix divide by zero
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregory Russell committed Nov 19, 2021
1 parent fe4b616 commit a06b4d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tcp/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ func (jt *JitterTracker) Add(tsval uint32, pktTime time.Time) {
if !jt.initialized {
jt.firstTSVal = tsval
jt.firstPktTime = pktTime
if !jt.lastPktTime.IsZero() {
if !jt.lastPktTime.IsZero() && (jt.lastTSVal != jt.firstTSVal) {
jt.tickRate = jt.lastPktTime.Sub(pktTime) / time.Duration(jt.lastTSVal-jt.firstTSVal)
} else {
jt.tickRate = time.Millisecond
Expand Down

0 comments on commit a06b4d0

Please sign in to comment.