From 97c612b5a0153169e29bf28ef8098ca4bb104786 Mon Sep 17 00:00:00 2001 From: Santoshkumar Zalake Date: Thu, 21 Nov 2019 10:49:19 +0530 Subject: [PATCH] Use gmtime_r function to avoid UTC time corruption. The gmtime library function is outputting corrupted UTC time as this function is not thread safer. CRs-Fixed: 2571035 Change-Id: Ieed088392e3094eb20fa9b526931a3a89d4f231c --- utils/loc_nmea.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/loc_nmea.cpp b/utils/loc_nmea.cpp index 876620f4..9ee27164 100644 --- a/utils/loc_nmea.cpp +++ b/utils/loc_nmea.cpp @@ -1195,7 +1195,8 @@ void loc_nmea_generate_pos(const UlpLocation &location, (location, locationExtended, systemInfo, utcPosTimestamp); time_t utcTime(utcPosTimestamp/1000); - tm * pTm = gmtime(&utcTime); + struct tm result; + tm * pTm = gmtime_r(&utcTime, &result); if (NULL == pTm) { LOC_LOGE("gmtime failed"); return;