#!/usr/bin/env python3 """Inspect timestamps in an app-private ring-frames.jsonl export (read-only). Prints clock metadata, never measurement values. A latest timestamp may be old; its age is not by itself a clock measurement. Repeated *future* HR timestamps tracking receipt time are stronger evidence. All output instants are UTC. """ import argparse import datetime import json import struct def utc(seconds): return datetime.datetime.fromtimestamp(seconds, datetime.timezone.utc).isoformat() def audit(record): raw = bytes.fromhex(record["raw"]) if len(raw) < 24 or raw[5:8] != b"\x64\x02\x64" or raw[10] != 2 or raw[12] != 1: return None if int.from_bytes(raw[13:15], "little") != len(raw) - 5: return None command = raw[11] metric = {1: "heart_rate", 2: "spo2", 4: "hrv", 5: "steps"}.get(command) if metric is None: return None payload = raw[15:] count, offset, anchor = struct.unpack_from("