Count ITS time in TAI, with the leap seconds since 2004

TimestampIts is TAI-based (TS 102 894-2 V2.5.1), 5 s ahead of UTC. ItsTime
left the leap seconds out, so the PoTi set the micrOBU's clock 5 s behind:
it rejected other stations' VAMs as Invalid_Timestamp and restarted its
stack (time_regression). CAM/VAM generationDeltaTime and the GN TST were
5 s off too.

ItsTime adds the leap seconds (IANA leap-seconds.list) and converts back
for received DENMs. Golden vectors regenerated through asn1tools.
This commit is contained in:
Niklas Dathe
2026-10-02 19:13:48 +02:00
parent d3fc9bf66c
commit f061c72581
10 changed files with 136 additions and 31 deletions
+5 -1
View File
@@ -34,6 +34,9 @@ from pathlib import Path
LLC_SNAP_GN = b"\xaa\xaa\x03\x00\x00\x00\x89\x47"
ITS_EPOCH_UNIX = 1072915200
# generationTime (IEEE 1609.2 Time64) counts TAI microseconds since the ITS epoch: 5 leap seconds ahead of
# UTC since 2017-01-01 (IANA leap-seconds.list), as TimestampIts and the app's ItsTime.
LEAP_SECONDS_SINCE_2004 = 5
def pcap_frames(path: Path):
@@ -227,7 +230,8 @@ def main() -> int:
# generationTime is compared with the file's modification time (end of the recording) instead.
recorded_until = args.pcap.stat().st_mtime
for ts, mac, r in ours[:5]:
gen = r["generation_time_us"] / 1e6 + ITS_EPOCH_UNIX if r["generation_time_us"] else None
gen = (r["generation_time_us"] / 1e6 + ITS_EPOCH_UNIX - LEAP_SECONDS_SINCE_2004
if r["generation_time_us"] else None)
print(" %s from %s: signer %s %s, psid %d, ITS PDU station %s, generationTime %s UTC "
"(%+.0f s before the recording ended), canonical %s, signature %s" % (
f"{ts:.3f}", mac.hex(":"), r["signer"], r["digest"], r["psid"], its_station(r.get("payload", b"")),