How do I get a microseconds timestamp in C?
I'm trying to do:
struct timeval tv;
You need to add in the seconds, too:
unsigned long time_in_micros = 1000000 * tv_sec + 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).