jbenet / ios-ntp

SNTP implementation for iOS
http://code.google.com/p/ios-ntp/
MIT License
371 stars 112 forks source link

iOS-ntp returning same value as device #43

Open usmaanirfan opened 8 years ago

usmaanirfan commented 8 years ago

iOS-ntp returning same value as device, when i change device time network time change as well please help what m i missing? as i check didReceiveData not get called in NetAssociation.

gavineadie commented 8 years ago

What time host are you using? If it doesn't exist or doesn't respond, you'll get this behavior. Remember that NTP is a UPD (datagram) protocol; unlike TCP it is not obliged to report network errors so your application will need to deal with them.

ankit776 commented 7 years ago

not able to get network time it always shows device time.

gavineadie commented 7 years ago

What time host are you using? The default is NO host and this behavior.

momin96 commented 7 years ago

I was having same problem, I solved it by placing below method call in application:didFinishLaunchWithoptions: NetworkClock * networkClock = [NetworkClock sharedNetworkClock];

But it introduced a new problem, First time I was able to fetch correct network time, but as soon as application went in background and came to foreground same issue arises. I tried to place above call in applicationWillEnterForeground: as well in applicationDidBecomeActive:, but did not found solution for above problem

I am using this host in ntp.hosts file in.pool.ntp.org Edit: I tested with time.apple.com and found, its not reliable.