fix(devices): Hikvision clock sync owns the time zone (fixed offset, re-set at DST edges)

park-2's cameras burned Beijing time into every frame: factory zone CST-8,
and the sync compared instants only, so zero drift meant the zone was never
touched. The G3H firmware also accepts a POSIX zone with a DST rule, echoes
it back, and ignores the rule.

syncClock now derives the site's current UTC offset as a fixed Hikvision
zone (hikvisionFixedZone) and rewrites it when it differs, sending the clock
with it. The device monitor adds a third trigger beside offline->ready and
the 24h backstop: the moment the site's UTC offset changes, so a DST switch
is handled within one poll. ClockSyncResult reports zoneChanged/timeZone.

Both park-2 cameras were set to CST-2:00:00 by hand on 2026-10-09; this
must be deployed there before 2026-10-25 or the OSD reads 1h ahead from
that day until it is.
This commit is contained in:
2026-10-11 18:17:25 +02:00
parent 9332802e5d
commit 7b29331f52
5 changed files with 163 additions and 31 deletions
+7 -1
View File
@@ -203,8 +203,14 @@ export interface ClockSyncResult {
/** Camera-vs-host drift in whole seconds at check time; null = the camera's
* reply was unparseable (treated as infinite drift → sync). */
readonly driftSeconds: number | null;
/** True when the camera clock was actually set (drift exceeded the threshold). */
/** True when the camera clock was actually set (drift exceeded the threshold, or the
* zone was rewritten — the clock is always re-sent with a zone change). */
readonly synced: boolean;
/** True when the camera's time-ZONE setting was rewritten to the site's current UTC
* offset (Hikvision only; see HikvisionCamera.syncClock). */
readonly zoneChanged?: boolean;
/** The camera's zone string after the call (Hikvision only), for the log line. */
readonly timeZone?: string;
}
/** Optional capability: a device whose clock the HOST can read + set. Hikvision