Okay, I did a little digging and here is what I came up with:
#import <mach/mach.h>
#import <mach/mach_time.h>
+ (NSTimeInterval)timestamp
{
// get the timebase info -- different on phone and OSX
mach_timebase_info_data_t info;
mach_timebase_info(&info);
// get the time
uint64_t absTime = mach_absolute_time();
// apply the timebase info
absTime *= info.numer;
absTime /= info.denom;
// convert nanoseconds into seconds and return
return (NSTimeInterval) ((double) absTime / 1000000000.0);
}
This appears to be equivalent to timestamp
from UIEvent
, which given what mach_absolute_time()
does makes a lot of sense.