How do I get a microseconds timestamp in C?
I\'m trying to do:
struct timeval tv; gettimeofday(&tv,NULL); return tv.tv_usec;
Bu
You need to add in the seconds, too:
unsigned long time_in_micros = 1000000 * tv.tv_sec + tv.tv_usec;
Note that this will only last for about 232/106 =~ 4295 seconds, or roughly 71 minutes though (on a typical 32-bit system).