Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Get the current time in microseconds in C.
#include <sys/time.h>
* Returns the current time in microseconds.
long getMicrotime(){
struct timeval currentTime;
gettimeofday(&currentTime, 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
You can’t perform that action at this time.