I'm trying to write a simple function in C that would calculate the difference between two moments in nanoseconds. To do this, I thought of using the function gettimeofday
, which updates the given struct timeval's fields.
As the man page said, the struct timeval's fields are:
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /* microseconds */
My question is as follows:
Is the tv_usec
field is the WHOLE TIME passed since the EPOCH in microseconds, or is it just the remain of the time in microseconds?
For example, if the time passed is 100 seconds and 25 microseconds, will the tv_usec
field have the value '25' or the value '100000025'?
Thanks a lot.
It's the remainder.