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

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -