fix NMEA Timestamp for good

pull/2462/head
Thomas Göttgens 2023-05-06 23:16:39 +02:00
rodzic 81bfd69a41
commit b4ff37104a
1 zmienionych plików z 4 dodań i 2 usunięć

Wyświetl plik

@ -59,8 +59,10 @@ uint32_t printGGA(char *buf, size_t bufsz, const meshtastic_Position &pos)
{
GeoCoord geoCoord(pos.latitude_i, pos.longitude_i, pos.altitude);
tm *t = localtime((time_t *)&pos.timestamp);
if (getRTCQuality() > 0) // use the device clock if we got time from somewhere. If not, use the GPS timestamp.
t = localtime((time_t *)getValidTime(RTCQuality::RTCQualityDevice));
if (getRTCQuality() > 0) { // use the device clock if we got time from somewhere. If not, use the GPS timestamp.
uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityDevice);
t = localtime((time_t *)&rtc_sec);
}
uint32_t len = snprintf(
buf, bufsz, "$GNGGA,%02d%02d%02d.%02d,%02d%07.4f,%c,%03d%07.4f,%c,%u,%02u,%04u,%04d,%c,%04d,%c,%d,%04d", t->tm_hour,