How can I locally detect iPhone clock advancement by a user between app runs?

CACurrentMediaTime & mach_absolute_time

Take a look at this questions:

iOS: How to measure passed time, independent of clock and time zone changes?

Calculating number of seconds between two points in time, in Cocoa, even when system clock has changed mid-way

CACurrentMediaTime uses mach_absolute_time:
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/CoreAnimation_functions/Reference/reference.html

Here you have an example on how to use CACurrentMediaTime:
http://www.informit.com/blogs/blog.aspx?b=02b4e309-308c-468a-bab1-cebb1404be6a

Here you have a more information on mach_absolute_time:
http://developer.apple.com/library/mac/#qa/qa1398/_index.html
http://shiftedbits.org/2008/10/01/mach_absolute_time-on-the-iphone/

Leave a Comment