From 9fcd739f1735fc3926041ecc8b8f6319b448ab41 Mon Sep 17 00:00:00 2001 From: Chadwick Boulay Date: Sat, 7 Oct 2023 00:44:10 -0400 Subject: [PATCH] Fix divide-by-zero error if we get an old or repeat procmon packet. --- pycbsdk/cbhw/device/nsp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pycbsdk/cbhw/device/nsp.py b/pycbsdk/cbhw/device/nsp.py index f7516dc..83fe405 100644 --- a/pycbsdk/cbhw/device/nsp.py +++ b/pycbsdk/cbhw/device/nsp.py @@ -401,7 +401,7 @@ def _handle_nplay(self, pkt): self._config["nplay"] = pkt def _handle_procmon(self, pkt): - update_interval = pkt.header.time - self._monitor_state["time"] + update_interval = max(pkt.header.time - self._monitor_state["time"], 1) pkt_delta = self.pkts_received - self._monitor_state["pkts_received"] v_int = [int(_) for _ in self._params.protocol.split(".")]