summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server/location
diff options
context:
space:
mode:
Diffstat (limited to 'services/java/com/android/server/location')
-rwxr-xr-xservices/java/com/android/server/location/GpsLocationProvider.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/services/java/com/android/server/location/GpsLocationProvider.java b/services/java/com/android/server/location/GpsLocationProvider.java
index 588fa93..65b9627 100755
--- a/services/java/com/android/server/location/GpsLocationProvider.java
+++ b/services/java/com/android/server/location/GpsLocationProvider.java
@@ -554,8 +554,13 @@ public class GpsLocationProvider implements LocationProviderInterface {
long delay;
- // GPS requires fresh NTP time
- if (mNtpTime.forceRefresh()) {
+ // force refresh NTP cache when outdated
+ if (mNtpTime.getCacheAge() >= NTP_INTERVAL) {
+ mNtpTime.forceRefresh();
+ }
+
+ // only update when NTP time is fresh
+ if (mNtpTime.getCacheAge() < NTP_INTERVAL) {
long time = mNtpTime.getCachedNtpTime();
long timeReference = mNtpTime.getCachedNtpTimeReference();
long certainty = mNtpTime.getCacheCertainty();