From e9a50d9f2521d72b1920cc46ca00fe241a5e46d6 Mon Sep 17 00:00:00 2001 From: Robert McMahon Date: Mon, 16 Feb 2026 17:44:33 -0800 Subject: [PATCH] Fix timestamp formatting for pcap: convert EDecimal to float for fromtimestamp Co-authored-by: Cursor --- wifi_monitor.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wifi_monitor.py b/wifi_monitor.py index 4700ce4..76d6de0 100755 --- a/wifi_monitor.py +++ b/wifi_monitor.py @@ -419,8 +419,12 @@ class CaptureAnalyzer: @staticmethod def _format_timestamp(pkt): """Format packet timestamp as HH:MM:SS.mmm.""" - if hasattr(pkt, 'time') and pkt.time: - dt = datetime.fromtimestamp(pkt.time) + if hasattr(pkt, 'time') and pkt.time is not None: + try: + ts = float(pkt.time) # pcap can give EDecimal; fromtimestamp needs int/float + except (TypeError, ValueError): + return "N/A" + dt = datetime.fromtimestamp(ts) return dt.strftime("%H:%M:%S.%f")[:-3] # Truncate to milliseconds return "N/A"