androidandroid-source

How to validate which NTP server is currently in use


I changed the default NTP server in AOSP from time.android.com to something else.

I did it by changing the key config_ntpServer in frameworks/base/core/res/res/values/config.xml

How can I validate on the device whether my change took effect or not?


Solution

  • You can check the events log by adb logcat -b events:

    If the system get time from the ntp server success, you will see:

    ntp_success: [time.android.com/216.239.35.0,704,860]
    

    If failed, you will see:

    ntp_failure: [time.android.com/216.239.35.0,"failed message"]
    

    The related source files are:

    core/java/android/util/NtpTrustedTime.java core/java/android/net/SntpClient.java