Created
June 7, 2016 15:48
-
-
Save w1k1n9cc/012be60361e73de86bee0bce51652aa7 to your computer and use it in GitHub Desktop.
Get the current time in microseconds in C.
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 <sys/time.h> | |
/** | |
* Returns the current time in microseconds. | |
*/ | |
long getMicrotime(){ | |
struct timeval currentTime; | |
gettimeofday(¤tTime, NULL); | |
return currentTime.tv_sec * (int)1e6 + currentTime.tv_usec; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the guy above me is an average command and control person