0x416e746f6e
0x416e746f6e

Reputation: 10136

High-precision timer in iOS

What is the most precise way to measure time intervals in iOS? So far I have been using NSDate to "mark" events and then timeIntervalSinceDate method to calculate the interval, but is there more precise approach? E.g. Windows has so called QPC for that kind of thing. Is there something similar in iOS (or MacOSX) world?

Upvotes: 0

Views: 1311

Answers (1)

Adam B
Adam B

Reputation: 3833

You can get down to nanoseconds using mach_absolute_time(). Here is an article on using it: https://developer.apple.com/library/mac/qa/qa1398/_index.html

It also exists on iOS.

Upvotes: 2

Related Questions