diff --git a/Sources/NetworkProtection/Diagnostics/NetworkProtectionConnectionBandwidthAnalyzer.swift b/Sources/NetworkProtection/Diagnostics/NetworkProtectionConnectionBandwidthAnalyzer.swift index 77ebdcf77..3ce0072d9 100644 --- a/Sources/NetworkProtection/Diagnostics/NetworkProtectionConnectionBandwidthAnalyzer.swift +++ b/Sources/NetworkProtection/Diagnostics/NetworkProtectionConnectionBandwidthAnalyzer.swift @@ -111,8 +111,16 @@ final class NetworkProtectionConnectionBandwidthAnalyzer { private func bytesPerSecond(newer: Snapshot, older: Snapshot) -> (rx: Double, tx: Double) { let deltaSeconds = newer.date.timeIntervalSince1970 - older.date.timeIntervalSince1970 - let rx = Double(newer.rxBytes - older.rxBytes) / deltaSeconds - let tx = Double(newer.txBytes - older.txBytes) / deltaSeconds + let rx: Double + let tx: Double + + if deltaSeconds > 0 { + rx = Double(newer.rxBytes - older.rxBytes) / deltaSeconds + tx = Double(newer.txBytes - older.txBytes) / deltaSeconds + } else { + rx = 0 + tx = 0 + } return (rx, tx) }