Created
February 2, 2016 19:43
-
-
Save anderspitman/37069b4223f6b8f7b4a3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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