我們知道,Android是通過連接指定的ntpServer來獲取網絡時間,而不同的服務器帶來的延遲也不盡相同,通常情況下,我們自然是期望盡快獲取時間,那么我們就需要對ntpServer有一定的篩選,尤其是在選擇默認的ntpServer的時候。
android中配置ntpServer的源文件:
frameworks/base/core/res/res/values/config.xml
此外,調整一下切換不同服務器之間的timeout也能加快獲取網絡時間
本猿實際測試中發現,下列服務器響應比較快,最大的平均響應時間低于150ms(可能與網絡也有一定的關系,不同地方可能有較大的差異):
sg.pool.ntp.org
tw.pool.ntp.org
3.asia.pool.ntp.org
jp.pool.ntp.org
cn.pool.ntp.org
hk.pool.ntp.org
th.pool.ntp.org
s2g.time.edu.cn
PS:國內主要的ntp服務器地址: