Gettimeofday - explanation of exact structvalval time values

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;     /* seconds */  
suseconds_t tv_usec;    /* microseconds */  

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.

+3
source share
1 answer

This is the remainder.

( ), . .

+4

Source: https://habr.com/ru/post/1793409/


All Articles