Skip to content

Instantly share code, notes, and snippets.

Embed
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;
}
@frattini

This comment has been minimized.

Copy link

frattini commented Oct 16, 2019

1537988539357328

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.