feat(decoder): warn when the decoder's clock is off (1.42.4)

The decoder's time is never changed. Passings (also during warm-up)
measure it against the computer's clock, and Race Day's preflight and
the decoder diagnostics warn when it is over a minute off, e.g. after
the switch to winter time.
This commit is contained in:
larssand committed 2026-10-25 18:40:35 +01:00
1 parent ca88fd9ecc
commit 35eb3eb059
14 files changed
+180 -5

No files matched your search

+11
View File
@@ -113,3 +113,14 @@ test("preflight shortcuts respect driver, shared-car and team setup", async () =
assert.equal(action({ id: "lap_window", level: "warning" }, { mode: "race" }).field, "minLapSec");
assert.equal(action({ id: "decoder", level: "ok" }), null);
});
test("Race Day preflight warns when the decoder's clock is off, but never blocks the start", () => {
const state = createState();
state.decoder.clockSkewMs = -3600000 - 40; // the decoder still on summer time: one hour ahead
const result = buildRaceDayPreflight(state, state.sessions[0], { backendAvailable: true });
const clock = result.checks.find((item) => item.id === "decoder_clock");
assert.deepEqual({ level: clock.level, ahead: clock.ahead, hours: clock.hours, minutes: clock.minutes }, { level: "warning", ahead: true, hours: 1, minutes: 0 });
assert.equal(result.ready, true, "a warning: the operator decides");
state.decoder.clockSkewMs = 25; // network delay only
assert.equal(buildRaceDayPreflight(state, state.sessions[0], { backendAvailable: true }).checks.some((item) => item.id === "decoder_clock"), false);
});