NTP on iOS

Questions and Answers about all things *OS (macOS, iOS, tvOS, watchOS)

NTP on iOS

Postby iOSSOi » Sun Feb 14, 2016 11:38 pm

Hello,

I know you and Esser aren't exactly friends, but he did raise an interesting question about iOS's NTP support -

https://twitter.com/i0n1c/status/697795459348353024

which was unanswered, and I am also wondering about - how is NTP used in iOS? I'm hoping you can answer this!
iOSSOi
 
Posts: 1
Joined: Sun Feb 14, 2016 11:32 pm

Re: NTP on iOS

Postby morpheus » Thu Feb 18, 2016 1:20 pm

hey - not far lack of my trying - but whatever. To answer your question:

the /usr/libexec/timed is the daemon in charge of handling all time on iOS/TvOS/etc. It provides xpc services to the system via com.apple.timed.pc, and is also triggered to run when airplane mode is changed (a common question in and of itself).

If you disassemble the daemon, even a simple jtool -d __TEXT.__cstring will reveal a ton of "sntp ..." messages. A left over path will show you that it's part of the SNTP project, which is actually open source - http://opensource.apple.com/source/ntp/ntp-102.20.1/

so you can very easily figure out the entire "ntp stack" this way. More looking around will also reveal that the default server is time-ios.apple.com. And of course deeper disassembly of the code itself will show you when the code actually gets executed. From a very cursory glance it looks like ntp is but one of several sources : lockdownd (when connecting over USB) is consulted, as is CoreTelephony (which is how the time auto sets if you land in a foreign country, even before you have a cellular data connection), and only then NTP. And the whole 1/1/70 bug is overblown. Phones won't brick permanently anyway - as soon as timezone puts you back in the positive, you're fine.

Hope this helps - bitte schön
morpheus
Site Admin
 
Posts: 532
Joined: Thu Apr 11, 2013 6:24 pm


Return to Questions and Answers

Who is online

Users browsing this forum: No registered users and 1 guest