Fix imported PCAP session duration for relative timestamps

SIGROK-derived PCAPs have relative timestamps (0, 1.37, 15.02) rather
than epoch time. The _REAL_TS_MIN check failed, so close_session() set
ended to wall-clock (same as started → duration 0s). Now close_session
accepts an optional duration_secs param; the import handler passes
last_ts - first_ts so the session gets the correct capture duration.
This commit is contained in:
catarrh committed 2026-09-06 13:01:46 +03:00
1 parent 05d7a26f2e
commit f9e399183c
2 files changed
+11 -3

No files matched your search

+2 -1
View File
@@ -346,7 +346,8 @@ class RequestHandler(BaseHTTPRequestHandler):
if first_ts is not None and first_ts > _REAL_TS_MIN:
self.db.set_session_times_from_ts(session_id, first_ts, last_ts)
else:
self.db.close_session(session_id)
duration = (last_ts - first_ts) if last_ts is not None and first_ts is not None else 0
self.db.close_session(session_id, duration)
_log(f'Session imported: session={session_id} '
f'name={name or "(untitled)"} messages={len(packets)} '