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
@@ -145,7 +145,7 @@ class DenmAirReceiveTest {
// detectionTime is a 42-bit TimestampIts counted from the 2004 ITS epoch. Getting either
// the width or the epoch wrong lands the hazard decades away, so the absolute value is
// asserted rather than a range.
assertEquals(1_786_979_460_563L, denm.detectionTimeMs)
assertEquals(1_786_979_455_563L, denm.detectionTimeMs) // TimestampIts is TAI: 5 leap seconds less in UTC
// Carried through from the GeoNetworking header and the serial prefix, not the payload.
assertEquals(1000, denm.relevanceRadiusM)
@@ -164,7 +164,7 @@ class DenmAirReceiveTest {
assertNull("a terminating DENM carries no SituationContainer", termDenm.causeCode)
assertEquals(4_194_380_752L, termDenm.stationId)
assertEquals(6, termDenm.sequenceNumber)
assertEquals(1_786_980_053_703L, termDenm.detectionTimeMs)
assertEquals(1_786_980_048_703L, termDenm.detectionTimeMs)
// The whole point of keying dedup on actionID: the termination must land on the same key as
// the event it ends, so filtering terminations actually removes that hazard from the map