Skip to content

Instantly share code, notes, and snippets.

@brysonian
Created March 24, 2011 20:50
Show Gist options
  • Save brysonian/885847 to your computer and use it in GitHub Desktop.
Save brysonian/885847 to your computer and use it in GitHub Desktop.
get a nanosecond accurate counter for ios and os x
uint64_t nanos() {
static mach_timebase_info_data_t info;
mach_timebase_info(&info);
uint64_t now = mach_absolute_time();
now *= info.numer;
now /= info.denom;
return now;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment