java - Android: Get Atomic Time -
i'm trying atomic time android app. i'm using http://hi-android.info/src/android/net/sntpclient.java.html ntp client , following code implement ntp (= sample code sntpclient.java):
sntpclient client = new sntpclient(); if (client.requesttime("time.foo.com")) { long = client.getntptime() + systemclock.elapsedrealtime() - client.getntptimereference(); }
i tried different server list: http://mindprod.com/jgloss/timesources.html, "client.requesttime("server")" "false" ...
my code:
sntpclient client = new sntpclient(); if (client.requesttime("hera.limescope.net", 10000)) { long = client.getntptime() + systemclock.elapsedrealtime() - client.getntptimereference(); textatomicclock.settext(string.valueof(now)); }
what doing wrong?
freddi
found mistake! didn't know had process ntp task in background ... solved problem androids asynctask function. helped me!
Comments
Post a Comment