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
This commit is contained in:
parent
3b3bcb1113
commit
97c612b5a0
1 changed files with 2 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue