From d72c2cc378cb6cb7b3a839fab05e4025123c5441 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Tue, 18 Mar 2025 18:19:54 +1300 Subject: [PATCH] uavcan: ignore 0 UTC timestamps (#24529) We need to wait for a valid UTC timestamp, otherwise we end up in 1970 with Here 4 which sends 0 for a bit even if there is already a fix. --- src/drivers/uavcan/sensors/gnss.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drivers/uavcan/sensors/gnss.cpp b/src/drivers/uavcan/sensors/gnss.cpp index 7fa9e843f7..7f67ff7a27 100644 --- a/src/drivers/uavcan/sensors/gnss.cpp +++ b/src/drivers/uavcan/sensors/gnss.cpp @@ -453,7 +453,7 @@ void UavcanGnssBridge::process_fixx(const uavcan::ReceivedDataStructure } // If we haven't already done so, set the system clock using GPS data - if ((fix_type >= sensor_gps_s::FIX_TYPE_2D) && !_system_clock_set) { + if (report.time_utc_usec != 0 && (fix_type >= sensor_gps_s::FIX_TYPE_2D) && !_system_clock_set) { timespec ts{}; // get the whole microseconds