AP_MSP: use gmtime_r() instead of gmtime()

using gmtime_r makes gmtime thread safe
This commit is contained in:
Andrew Tridgell 2024-02-07 09:32:49 +11:00
parent 3cb3e6feda
commit fca0aa3d02
1 changed files with 2 additions and 1 deletions

View File

@ -1023,7 +1023,8 @@ MSPCommandResult AP_MSP_Telem_Backend::msp_process_out_rtc(sbuf_t *dst)
#if AP_RTC_ENABLED
if (AP::rtc().get_utc_usec(time_usec)) { // may fail, leaving time_unix at 0
const time_t time_sec = time_usec / 1000000;
localtime_tm = *gmtime(&time_sec);
struct tm tmd {};
localtime_tm = *gmtime_r(&time_sec, &tmd);
}
#endif
const struct PACKED {