DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

time(FP)


time -- data definitions for clocks and timers

Description

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

 +------------+-------------+-------------+
 |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

 +----------------+-------------+------------------+
 |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.

 +-------------+----------------------------------+
 |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.

See also

timer_create(S), timer_delete(S), timer_settime(S)

Standards conformance

Text reprinted and/or adapted from IEEE Std 1003.1b-1993, IEEE Standard for Information Technology, POSIX Part 1: System Application Program Interface (API) Amendment 1: Realtime Extensions [C Language], copyright © 1993 by the Institute of Electrical and Electronics Engineers, Inc. The IEEE takes no responsibility for and will assume no liability for damages resulting from the reader's misinterpretation of said information resulting from the placement and context in this publication. Information is reproduced with the permission of the IEEE.


© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003