Fix pcapng timestamp resolution + imported-session duration
- pcap.py: _parse_tsresol now pads options to a 32-bit boundary ((-length) % 4) and uses 2** for the MSB-set (power-of-2) case, so nanosecond if_tsresol is read correctly (was defaulting to µs and scaling timestamps 1000x) - database/server: set imported session started/ended from the first/last packet timestamps (falling back to wall-clock for synthetic SPB) - frontend: formatDuration renders hours - tests: tsresol (ns after padded option, default µs, ns round-trip) and session-window/fallback (119 total)
This commit is contained in:
1 parent
5ba55ac3a9
commit
c21b655fe1
5 files changed
+82
-4
No files matched your search
@@ -322,12 +322,20 @@ class RequestHandler(BaseHTTPRequestHandler):
|
||||
self.db.rename_session(session_id, name)
|
||||
|
||||
first_ts = packets[0][0]
|
||||
last_ts = packets[-1][0]
|
||||
rows = []
|
||||
for ts, msg_type, payload in packets:
|
||||
elapsed = round(ts - first_ts, 6) if ts is not None else 0.0
|
||||
rows.append((max(0.0, elapsed), msg_type, payload, 0))
|
||||
self.db.insert_messages(session_id, rows)
|
||||
self.db.close_session(session_id)
|
||||
# Use the packet timestamps as the session window when they are real
|
||||
# (classic pcap / pcapng EPB). pcapng SPB-only files have synthetic
|
||||
# 0,1,2,… timestamps, so fall back to the import wall-clock time.
|
||||
_REAL_TS_MIN = 946684800 # 2000-01-01
|
||||
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)
|
||||
|
||||
self._send_json({
|
||||
'session_id': session_id,
|
||||
|
||||
Reference in new issue
Block a user