I am trying to write a simple function in C that would calculate the difference between two points in nanoseconds. To do this, I thought about using a function gettimeofdaythat updates the given structvalval fields.
As indicated in the man page, the timeval fields of the structure:
time_t tv_sec;
suseconds_t tv_usec;
My question is this:
tv_usecIs the field the FULL TIME elapsed with EPOCH in microseconds, or is it just the remaining time in microseconds?
For example, if the time has passed 100 seconds and 25 μs, will the field tv_usechave a value of "25" or a value of "100000025"?
Many thanks.
source
share