Loading Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -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 \ Loading core/java/android/net/EventLogTags.logtags 0 → 100644 +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) core/java/android/net/SntpClient.java +4 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } Loading Loading @@ -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"); Loading @@ -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 { Loading core/res/res/values/config.xml +1 −1 Original line number Diff line number Diff line Loading @@ -1650,7 +1650,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 --> Loading Loading
Android.mk +1 −0 Original line number Diff line number Diff line Loading @@ -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 \ Loading
core/java/android/net/EventLogTags.logtags 0 → 100644 +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)
core/java/android/net/SntpClient.java +4 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } Loading Loading @@ -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"); Loading @@ -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 { Loading
core/res/res/values/config.xml +1 −1 Original line number Diff line number Diff line Loading @@ -1650,7 +1650,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 --> Loading