A simple question: do time(...)and clock_gettime( CLOCK_REALTIME, ... )produce theoretical time (only in relation to seconds)?
Here is what I mean:
time_t epoch;
time( &epoch );
and
struct timespec spec;
clock_gettime( CLOCK_REALTIME, &spec );
Are these two people supposed to return exactly the same result (in relation to seconds)?
I “tested” it with changing time and time zones, epochand I spec.tv_secalways showed the same result, but the documentation CLOCK_REATIMEconfuses me a little, and I'm not sure that they will always be the same.
: , time. ( spec.tv_nsec, 1000000). time clock_gettime, , .
- Linux - getrusage vs clock_gettime vs gettimeofday vs timespec_get?, .. .