Reputation: 5200
I just read in the docs that:
Cocoa implements time according to the Network Time Protocol (NTP) standard, which is based on Coordinated Universal Time.
I am correct to assume that for OSX is syncing with the internet, correct?
What about iOS devices? Are the same NSObjects (NSDate, NSCalendar, etc...) also syncing with the internet, or are they getting time from the iPhone's carrier (e.g., AT&T, Verizon, etc...)? Does Cocoa-Touch work in the same way as Cocoa with respect to getting and syncing time?
If it doesn't, and instead, gets time from the carrier, what would be the way one would grab the time from the internet for an iOS application? I don't need sample code - I only need to be pointed in the right direction.
Thanks!
Upvotes: 4
Views: 5126
Reputation: 4155
iOS is getting time from different sources, one of them is the NTP. Ideally the time is updating from the GPS - which is the most accurate time that you can get (it's an atomic clock basically), or from the carrier (through the NITZ). Otherwise, the device falls on the NTP. Lastly, when you plug in your device to iTunes, your time is being updated as well. So Cocoa touch differs in that it has both the GPS and the carriers that Cocoa doesnt have.
Upvotes: 2