Skip to content

Instantly share code, notes, and snippets.

@yorung
Created June 7, 2015 13:11
Show Gist options
  • Save yorung/48337cdae0c9105e1768 to your computer and use it in GitHub Desktop.
Save yorung/48337cdae0c9105e1768 to your computer and use it in GitHub Desktop.
GetTime (older method)
double GetTime()
{
timespec t;
clock_gettime(CLOCK_MONOTONIC, &t);
return (double)t.tv_sec + (double)t.tv_nsec / 1000000000;
}
double GetTime()
{
LARGE_INTEGER t, f;
QueryPerformanceCounter(&t);
QueryPerformanceFrequency(&f);
return (double)t.QuadPart / f.QuadPart;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment