In Linux, the current time is maintained by keeping the number of seconds elapsed since midnight of January 01, 1970 (called epoch); the second elements in each of these represent the time elapsed since the last second in microseconds and nanoseconds, respectively:
struct timespec { __kernel_time_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ }; #endif struct timeval { __kernel_time_t tv_sec; /* seconds */ __kernel_suseconds_t tv_usec; /* microseconds */ };
Time (counter value) read from the clock source needs to be accumulated and tracked somewhere; the structure struct tk_read_base, defined in include/linux/timekeeper_internal.h, serves this purpose:
struct tk_read_base { struct clocksource *clock; cycle_t ...