Created
April 23, 2015 07:00
-
-
Save pfigue/8cbc2ca7fa3c4aa0135e to your computer and use it in GitHub Desktop.
Example of using libC clock() function.
This file contains 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
/* | |
* | |
* Compile with: `gcc -o clock clock.c` | |
* | |
* [clock(3) - Linux man page](http://linux.die.net/man/3/clock): *The value returned is the CPU time used [by the process] so far[...]* | |
* [What’s the correct way to use printf to print a clock_t?](http://stackoverflow.com/questions/1083142/what-s-the-correct-way-to-use-printf-to-print-a-clock-t) | |
* | |
*/ | |
#include <stdio.h> | |
#include <time.h> | |
#include <stdint.h> | |
int main(int argc, char **argv){ | |
clock_t j; | |
j = clock(); | |
printf("clock(): %ju\n", (uintmax_t)j ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment