Skip to content

Instantly share code, notes, and snippets.

@anderspitman
Created February 2, 2016 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anderspitman/37069b4223f6b8f7b4a3 to your computer and use it in GitHub Desktop.
Save anderspitman/37069b4223f6b8f7b4a3 to your computer and use it in GitHub Desktop.
#include <time.h>
double getCPUTimeSeconds() {
clock_t time = clock();
return (double)time / CLOCKS_PER_SEC;
}
double getWallTimeSeconds() {
struct timespec time;
clock_gettime(CLOCK_MONOTONIC, &time);
return time.tv_sec + (time.tv_nsec / 1000000000.0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment