Gets the current value of the systemwide clock. Format #include <timers.h> int getclock (int clktyp, struct timespec *tp);
1 – Arguments
clktyp The type of systemwide clock. tp Pointer to a timespec structure space where the current value of the systemwide clock is stored.
2 – Description
The getclock function sets the current value of the clock specified by clktyp into the location pointed to by 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 systemwide 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 (in nanoseconds) */ };
3 – Return Values
0 Indicates success. -1 Indicates an error; errno is set to one of the following values: o EINVAL - The clktyp argument does not specify a known systemwide clock. Or, the value of SYS$TIMEZONE_DIFFERENTIAL logical is wrong. o EIO - An error occurred when the systemwide clock specified by the clktyp argument was accessed.