From 20cb709ca24316f88fdbbaa00a459b95d75c9601 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 7 Feb 2024 12:22:53 +1100 Subject: [PATCH] AP_Periph: use gmtime_r() instead of gmtime() --- Tools/AP_Periph/msp.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tools/AP_Periph/msp.cpp b/Tools/AP_Periph/msp.cpp index e7d130f76f..8c3858fbe0 100644 --- a/Tools/AP_Periph/msp.cpp +++ b/Tools/AP_Periph/msp.cpp @@ -110,7 +110,8 @@ void AP_Periph_FW::send_msp_GPS(void) } uint64_t tepoch_us = gps.time_epoch_usec(0); 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.month = tm->tm_mon;