TimeSpec
Timespec is a data type used in POSIX and C libraries to represent a time value with second and nanosecond precision. It is defined as a small structure containing two fields: tv_sec, which is a time_t specifying seconds since the Unix epoch (00:00:00 UTC on 1 January 1970), and tv_nsec, a long integer specifying nanoseconds within the current second (0 to 999,999,999). The exact types can vary by platform, but the concept is a two-part representation of time or duration with nanosecond precision.
Timespec is widely used with clock and timer APIs. Functions such as clock_gettime, clock_nanosleep, and nanosleep
Clocks and semantics differ for the two primary uses. For CLOCK_REALTIME, the value represents wall clock time,
Portability considerations include variability in the underlying types of tv_sec and tv_nsec and potential overflow in