get time elapsed from log files

This commit is contained in:
2026-06-03 17:10:59 -04:00
parent 24cf346a62
commit 8a11acfcfd
3 changed files with 49 additions and 38 deletions
+1 -34
View File
@@ -246,43 +246,10 @@ def extract_measurement_metrics(db_file_path):
GROUP BY COM_Dst_endpoint
"""
).fetchall()
elapsed_row = conn.execute(
"""
WITH first_last AS (
SELECT
(SELECT COM_time FROM MEASUREMENT ORDER BY rowid ASC LIMIT 1) AS start_time,
(SELECT COM_time FROM MEASUREMENT ORDER BY rowid DESC LIMIT 1) AS end_time
)
SELECT
ROUND(
CASE
WHEN end_sec >= start_sec THEN
end_sec - start_sec
ELSE
(end_sec - start_sec) + 86400
END
) AS elapsed_seconds
FROM (
SELECT
(strftime('%H', start_time) * 3600 +
strftime('%M', start_time) * 60 +
strftime('%S', start_time)) AS start_sec,
(strftime('%H', end_time) * 3600 +
strftime('%M', end_time) * 60 +
strftime('%S', end_time)) AS end_sec
FROM first_last
);
"""
).fetchone()
finally:
conn.close()
result = {"duration_seconds": None, "tputResults": []}
if elapsed_row and elapsed_row["elapsed_seconds"] is not None:
result["duration_seconds"] = int(elapsed_row["elapsed_seconds"])
result = {"tputResults": []}
rssi_by_endpoint = {
row["COM_Dst_endpoint"]: {