The header file <time.h> defines the types and manifest
constants used by the timing facility.
Time value specification structures
Many of the timing facility functions accept or return time
value specifications. A time value structure
timespec specifies a single time value.
Member type
Member name
Description
time_t
tv_sec
Seconds
long
tv_nsec
Nanoseconds
The tv_nsec member is only valid if greater than or equal
to zero, and less than the number of nanoseconds in a second (1000
million). The time interval described by this structure is
(tv_sec * 10^9 + tv_nsec) nanoseconds.
A time value structure itimerspec specifies an initial
timer value and a repetition interval for use by the per-process
timer functions. This structure includes the following members:
Member type
Member name
Description
struct timespec
it_interval
Timer period
struct timespec
it_value
Timer expiration
If the value described by it_value is non-zero, it
indicates the time to or time of the next timer expiration (for
relative and absolute timer values, respectively). If the value
described by it_value is zero, the timer is disarmed.
If the value described by it_interval is non-zero, it
specifies an interval to be used in reloading the timer when
it expires: that is, a periodic timer is specified. If the value
described by it_interval is zero, the timer is disarmed
after its next expiration: that is, a ``one-shot'' timer is
specified.
Type definitions
The following types are defined by the implementation in
<sys/types.h>.
Defined type
Description
clockid_t
Used for clock ID type
in the clock and timer functions
timer_t
Used for timer ID returned
by the timer_create(S) function.
Manifest constants
The following constants are defined in <time.h>:
CLOCK_REALTIME
The identifier for the system-wide realtime clock.
TIMER_ABSTIME
Flag indicating time is ``absolute'' with respect to the clock
associated with a timer.
The maximum allowable resolution for the CLOCK_REALTIME
clock and all timers based on this clock is represented by
{_POSIX_CLOCKRES_MIN} and is defined as 20 milliseconds
(1/50 of a second).
The minimum allowable maximum value for the CLOCK_REALTIME
clock and absolute timers based on it is the same as that defined by
ISO/IEC 9899: 1990, Programming Languages - C for the
time_t type.