From bc47d0e76566b9d98030da18f99d3d7f83326dbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20F=C4=85ferek?= Date: Sat, 31 Jan 2026 20:34:24 +0100 Subject: [PATCH] fix(faults): handle simulation time timestamps in fault display When running with use_sim_time=true, fault timestamps are recorded in simulation time (seconds since sim start) instead of Unix epoch. This caused UI to display dates like "1/1/1970 00:02:28". Detect small timestamps (< year 2000) and substitute current time as a workaround until fault_manager is fixed to use wall clock time. --- src/lib/sovd-api.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib/sovd-api.ts b/src/lib/sovd-api.ts index e488583..69fe9df 100644 --- a/src/lib/sovd-api.ts +++ b/src/lib/sovd-api.ts @@ -1574,7 +1574,15 @@ export class SovdApiClient { message: apiFault.description, severity, status, - timestamp: new Date(apiFault.first_occurred * 1000).toISOString(), + // TODO: Remove this workaround after fixing ros2_medkit fault_manager + // to use wall clock time instead of sim time for fault timestamps. + // See: ros2_medkit/docs/issues/fault-timestamp-sim-time-bug.md + // Handle simulation time (small values) vs real Unix timestamps + // If timestamp < year 2000, it's likely sim time - use current time instead + timestamp: + apiFault.first_occurred < 946684800 + ? new Date().toISOString() + : new Date(apiFault.first_occurred * 1000).toISOString(), entity_id, entity_type, parameters: {