msm8226-common: gps: Correct week rollover timestamps

This adjustment will help with applications checking the time coming from gps.
Some applictions will consider times in the far past as an error.

Change-Id: I69d6971249c4898ac3895f725e46f268cdb2b00d
This commit is contained in:
jlask 2020-05-19 10:04:37 -05:00 committed by matteo0026
parent 98897a72ab
commit 6cc6f05cb7

View file

@ -240,6 +240,12 @@ void LocApiBase::reportPosition(UlpLocation &location,
location.gpsLocation.bearing, location.gpsLocation.accuracy,
location.gpsLocation.timestamp, location.rawDataSize,
location.rawData, status, loc_technology_mask);
if (location.gpsLocation.timestamp > 0 && location.gpsLocation.timestamp < 1580000000000) {
location.gpsLocation.timestamp += 619315200000; /* 1024 * 7 * 24 * 60 * 60 * 1000 */
LOC_LOGV("week rollover fixed, timestamp: %lld.", location.gpsLocation.timestamp);
}
// loop through adapters, and deliver to all adapters.
TO_ALL_LOCADAPTERS(
mLocAdapters[i]->reportPosition(location,