Created
September 4, 2014 12:42
-
-
Save REPOmAN2v2/ac02bafaa571624b841a to your computer and use it in GitHub Desktop.
getTime()
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
float getTime() | |
{ | |
static uint_least64_t start = 0; | |
struct timeval tv; | |
if (start == 0) { | |
gettimeofday(&tv,NULL); | |
start = 1000000 * tv.tv_sec + tv.tv_usec; | |
return 0.0f; | |
} | |
uint_least64_t counter = 0; | |
gettimeofday(&tv,NULL); | |
counter = 1000000 * tv.tv_sec + tv.tv_usec; | |
return (counter - start) / 1000000.0f; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment