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

ios, nsdate, ntp

Solution

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.

Problem

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.

Original source