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).
More Related Contents:
- HOW I CALCULATE TIME IN C PROGRAM
- Measure time in Linux – time vs clock vs getrusage vs clock_gettime vs gettimeofday vs timespec_get?
- clock_gettime alternative in Mac OS X
- Get the current time in C [duplicate]
- Calculating elapsed time in a C program in milliseconds
- implement time delay in c
- How to print time difference in accuracy of milliseconds and nanoseconds from C in Linux?
- How to print time in format: 2009‐08‐10 18:17:54.811
- How do I measure time in C?
- What is time(NULL) in C?
- How to convert from UTC to local time in C?
- Time stamp in the C programming language
- Usage of uint_8, uint_16 and uint_32
- C Program that reads and Stores a series of integers
- What does the ??!??! operator do in C?
- When should I use ampersand with scanf()
- “#include” a text file in a C program as a char[]
- What exactly do C include guards do?
- How to print every executed line in GDB automatically until a given breakpoint is reached?
- What are C macros useful for?
- Global variables in C are static or not?
- How garbage values are assigned to variables in c
- c popen won’t catch stderr
- While-loop ignores scanf the second time
- what “inline __attribute__((always_inline))” means in the function?
- Is there a way to get warned about unused functions?
- Get the exact time for a remote server
- C initialize array within structure
- How to store a variable at a specific memory location?
- What is the difference between %f and %lf in C?