Java, android, get atomic time from itnernet server

假如想象 提交于 2019-12-11 09:42:03

问题


i trying to synchronize two apps. How can i get the server time of any server with an accuracy up to 1ms? or maybe just 10ms?

i tried this some SNTP Clients, but they give me only my destination time or only with an accuracy up to 1s.

Pls help.


回答1:


You need to configure your SNTP client to follow a time server out there. There are 2 ways to sync your time. SLAM, or SLEW.

SLAM, just takes the server time and throws it on the client.

SLEW, takes the server time and corrects your client time, over the next few minutes.

In your case, I suggest that, as your application loads, use SLAM.

In the uxix, netware world, there were utilities like ntpdate for slaming, and ntpd for slewing.

SNTP is the way to go, these clients have been around for like 15 years now, so its very stable. Infact new development stopped like 8 years back. So it ought to be very stable. Just take more time and configure it right.

sntp android



来源:https://stackoverflow.com/questions/11737704/java-android-get-atomic-time-from-itnernet-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!