Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get the actual date and time if the device date and time are inaccurate?

Tags:

ios

nsdate

ntp

I noticed that if I set my device time manually, and turn off the automatic time sync on my iOS device, [NSDate date] returns the date and time assuming the device time is correct--which it may not be.

Since the docs mention that NSDate has some sort of sync with NTP, I am wondering if there is any built-in way to get the accurate date and time instead of having to assume the device date and time is correct.

like image 358
Anton Avatar asked Feb 19 '13 18:02

Anton


1 Answers

Perhaps https://github.com/jbenet/ios-ntp can help you? It's a library that can fetch the date and time from a time server.

like image 192
Cthutu Avatar answered Nov 05 '22 13:11

Cthutu