Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f50bac9a authored by Mike Lockwood's avatar Mike Lockwood Committed by Android Git Automerger
Browse files

am ad903e80: Merge "GpsLocationProvider: Remove NTP sanity checking now that...

am ad903e80: Merge "GpsLocationProvider: Remove NTP sanity checking now that the NTP client has been fixed." into kraken
parents 186bad00 ad903e80
Loading
Loading
Loading
Loading
+2 −12
Original line number Diff line number Diff line
@@ -478,24 +478,14 @@ public class GpsLocationProvider implements LocationProviderInterface {
            long timeReference = client.getNtpTimeReference();
            int certainty = (int)(client.getRoundTripTime()/2);
            long now = System.currentTimeMillis();
            long systemTimeOffset = time - now;

            Log.d(TAG, "NTP server returned: "
                    + time + " (" + new Date(time)
                    + ") reference: " + timeReference
                    + " certainty: " + certainty
                    + " system time offset: " + systemTimeOffset);
                    + " system time offset: " + (time - now));

            // sanity check NTP time and do not use if it is too far from system time
            if (systemTimeOffset < 0) {
                systemTimeOffset = -systemTimeOffset;
            }
            if (systemTimeOffset < MAX_NTP_SYSTEM_TIME_OFFSET) {
            native_inject_time(time, timeReference, certainty);
            } else {
                Log.e(TAG, "NTP time differs from system time by " + systemTimeOffset
                        + "ms.  Ignoring.");
            }
            delay = NTP_INTERVAL;
        } else {
            if (DEBUG) Log.d(TAG, "requestTime failed");