Gets the current value of the system-wide clock.
#include <timers.h> int getclock (int clktyp, struct timespec *tp);
The clktyp argument is given as a symbolic constant name, as defined in the <timers.h> header file. Only the TIMEOFDAY symbolic constant, which specifies the normal time-of-day clock to access for system-wide time, is supported.
For the clock specified by TIMEOFDAY, the value returned by this function is the elapsed time since the Epoch. The Epoch is referenced to 00:00:00 UTC (Coordinated Universal Time) 1 Jan 1970.
The getclock function returns a timespec structure, which is defined in the <timers.h> header file as follows:
struct timespec { unsigned long tv_sec /* Elapsed time in seconds since the Epoch*/ long tv_nsec /* Elapsed time as a fraction of a second */ /* since the Epoch (expressed in nanoseconds */ };
0 | Indicates success. |
-1 | Indicates an error; errno is set to one
of the following values:
|