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

Commit 06124cc8 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Lorenzo Colitti
Browse files

Switch over to new "time.android.com" NTP pool.

Also add logging to measure success/failure details.

Test: builds, boots, and NTP fix obtained
Bug: 32969463

(cherry picked from commit d3f689bf)

Change-Id: I7da416099ae903fd92beb516251ef4e51673eecf
parent 94eab5c5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ LOCAL_SRC_FILES += \
       core/java/android/app/admin/SecurityLogTags.logtags \
       core/java/android/content/EventLogTags.logtags \
       core/java/android/speech/tts/EventLogTags.logtags \
       core/java/android/net/EventLogTags.logtags \
       core/java/android/webkit/EventLogTags.logtags \
       core/java/com/android/internal/logging/EventLogTags.logtags \

+6 −0
Original line number Diff line number Diff line
# See system/core/logcat/event.logtags for a description of the format of this file.

option java_package android.net

50080 ntp_success (server|3),(rtt|2),(offset|2)
50081 ntp_failure (server|3),(msg|3)
+4 −2
Original line number Diff line number Diff line
@@ -36,8 +36,7 @@ import java.util.Arrays;
 * }
 * </pre>
 */
public class SntpClient
{
public class SntpClient {
    private static final String TAG = "SntpClient";
    private static final boolean DBG = true;

@@ -88,6 +87,7 @@ public class SntpClient
        try {
            address = InetAddress.getByName(host);
        } catch (Exception e) {
            EventLogTags.writeNtpFailure(host, e.toString());
            if (DBG) Log.d(TAG, "request time failed: " + e);
            return false;
        }
@@ -142,6 +142,7 @@ public class SntpClient
            //             = (transit + skew - transit + skew)/2
            //             = (2 * skew)/2 = skew
            long clockOffset = ((receiveTime - originateTime) + (transmitTime - responseTime))/2;
            EventLogTags.writeNtpSuccess(address.toString(), roundTripTime, clockOffset);
            if (DBG) {
                Log.d(TAG, "round trip: " + roundTripTime + "ms, " +
                        "clock offset: " + clockOffset + "ms");
@@ -153,6 +154,7 @@ public class SntpClient
            mNtpTimeReference = responseTicks;
            mRoundTripTime = roundTripTime;
        } catch (Exception e) {
            EventLogTags.writeNtpFailure(address.toString(), e.toString());
            if (DBG) Log.d(TAG, "request time failed: " + e);
            return false;
        } finally {
+1 −1
Original line number Diff line number Diff line
@@ -1681,7 +1681,7 @@
    <bool name="config_actionMenuItemAllCaps">true</bool>

    <!-- Remote server that can provide NTP responses. -->
    <string translatable="false" name="config_ntpServer">2.android.pool.ntp.org</string>
    <string translatable="false" name="config_ntpServer">time.android.com</string>
    <!-- Normal polling frequency in milliseconds -->
    <integer name="config_ntpPollingInterval">86400000</integer>
    <!-- Try-again polling interval in milliseconds, in case the network request failed -->