gps: use UTC timestamp when GPS fixed (#26127)

This commit is contained in:
Tom Willow 2025-12-27 08:50:37 +08:00 committed by GitHub
parent f46fd89057
commit 1e618a7eb0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 2 deletions

View File

@ -68,7 +68,13 @@ private:
hrt_abstime now{};
if (_sensor_gps_sub.update(&gps)) {
msg.time_usec = gps.timestamp;
if (gps.time_utc_usec > 0) {
msg.time_usec = gps.timestamp;
} else {
msg.time_usec = gps.time_utc_usec;
}
msg.fix_type = gps.fix_type;
msg.lat = static_cast<int32_t>(round(gps.latitude_deg * 1e7));
msg.lon = static_cast<int32_t>(round(gps.longitude_deg * 1e7));

View File

@ -68,7 +68,13 @@ private:
hrt_abstime now{};
if (_sensor_gps_sub.update(&gps)) {
msg.time_usec = gps.timestamp;
if (gps.time_utc_usec > 0) {
msg.time_usec = gps.timestamp;
} else {
msg.time_usec = gps.time_utc_usec;
}
msg.fix_type = gps.fix_type;
msg.lat = static_cast<int32_t>(round(gps.latitude_deg * 1e7));
msg.lon = static_cast<int32_t>(round(gps.longitude_deg * 1e7));