mirror of https://github.com/ArduPilot/ardupilot
AP_Periph: use gmtime_r() instead of gmtime()
This commit is contained in:
parent
3d4dbd0aed
commit
20cb709ca2
|
@ -110,7 +110,8 @@ void AP_Periph_FW::send_msp_GPS(void)
|
||||||
}
|
}
|
||||||
uint64_t tepoch_us = gps.time_epoch_usec(0);
|
uint64_t tepoch_us = gps.time_epoch_usec(0);
|
||||||
time_t utc_sec = tepoch_us / (1000U * 1000U);
|
time_t utc_sec = tepoch_us / (1000U * 1000U);
|
||||||
struct tm* tm = gmtime(&utc_sec);
|
struct tm tvd {};
|
||||||
|
struct tm* tm = gmtime_r(&utc_sec, &tvd);
|
||||||
|
|
||||||
p.year = tm->tm_year+1900;
|
p.year = tm->tm_year+1900;
|
||||||
p.month = tm->tm_mon;
|
p.month = tm->tm_mon;
|
||||||
|
|
Loading…
Reference in New Issue