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
@@ -31,9 +31,12 @@ class CamEncodeGoldenTest {
/**
* asn1tools-verified encoding of [referenceCam]. The trap this pins down: `YawRateConfidence`
* has nine enumerands (0..8), so it needs 4 bits and `unavailable` is 8 - not 3 bits and 7.
* generationDeltaTime 19080 is TimestampIts mod 65536 with the 5 leap seconds since 2004 (TAI,
* TS 102 894-2 V2.5.1); regenerated 2026-10 through asn1tools from the earlier UTC-based vector
* (14080), every other bit unchanged.
*/
private val expectedHex =
"0202000f423f3700402ab215af6e286477dffffffc23b7743e0027ffc0d0fe0118329337feebfff6000000"
"0202000f423f4a88402ab215af6e286477dffffffc23b7743e0027ffc0d0fe0118329337feebfff6000000"
private val referenceCam = Cam(
stationId = 999_999L,