clock_gettime(3P4)
NAME
clock_gettime − get value of clock
SYNOPSIS
#include <sys/types.h>
#include <time.h>
int clock_gettime(clock_id, tp)
int clock_id
struct timespec ∗tp
DESCRIPTION
The clock_gettime function returns the current value tp for the specified POSIX.4 clock, clock_id. The only valid POSIX.4 clock ID is CLOCK_REALTIME The values returned in tp represent the amount of time (in seconds and nanoseconds) since the Epoch. The Epoch is defined as (Jan 1 00:00:00 1970, Coordinated Universal Time).
The timespec structure definition is:
struct timespec {
time_t tv_sec; /∗ seconds ∗/
long tv_nsec; /∗ nanoseconds ∗/
}
RETURN VALUE
Upon successful completion, the clock_gettime function returns a zero. If any of the following conditions occur, the clock_gettime function shall return -1 and set errno to the corresponding value:
[EINVAL] The clock_id argument does not specify a known clock.
FILES
/usr/lib/libposix4.a
SEE ALSO
clock_settime(3P4), clock_getres(3P4).
WARNING
The interface to clock_gettime is based on IEEE Draft Standard P1003.4/D12. This is an unapproved draft, subject to change. Use of information contained in this unapproved draft is at your own risk. This interface will change to reflect any changes made by future drafts of POSIX 1003.4.
CX/UX Programmer’s Reference Manual