Sam Rowlands
Sam Rowlands

Reputation: 31

How to accurately measure time difference xcode

I need to super accurately measure time difference in xcode. I'm fairly new to Xcode and Objective C but I'm not really sure how to start it.

I need to measure the time difference between when a sound is played through the speaker and when the sound is recorded through the mic.

I'm not sure how to measure time this accurately as it will be a very short amount of time.

Any pointers or help would be much appreciated!

Thanks

Upvotes: 0

Views: 756

Answers (1)

一二三
一二三

Reputation: 21249

The most precise clock is probably mach_absolute_time---returning ticks since the device was last booted. See this Q&A from Apple for an example of how to use it and convert it into a nicer unit.

Upvotes: 2

Related Questions