Skip to content

Instantly share code, notes, and snippets.

@samdmarshall
Created May 1, 2015 15:38
Show Gist options
  • Save samdmarshall/fbb80b1b43d34549a4be to your computer and use it in GitHub Desktop.
Save samdmarshall/fbb80b1b43d34549a4be to your computer and use it in GitHub Desktop.
// taken from https://opensource.apple.com/source/CF/CF-855.17/CFDate.c
CFAbsoluteTime CFAbsoluteTimeGetCurrent(void) {
CFAbsoluteTime ret;
struct timeval tv;
gettimeofday(&tv, NULL); // http://linux.die.net/man/2/gettimeofday
ret = (CFTimeInterval)tv.tv_sec - kCFAbsoluteTimeIntervalSince1970;
ret += (1.0E-6 * (CFTimeInterval)tv.tv_usec);
return ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment