TIMERADD(3) | Library Functions Manual | TIMERADD(3) |
timerclear
,
timerisset
, timerisvalid
,
timercmp
, timersub
,
timeradd
, timespecclear
,
timespecisset
,
timespecisvalid
,
timespeccmp
, timespecsub
,
timespecadd
,
TIMEVAL_TO_TIMESPEC
,
TIMESPEC_TO_TIMEVAL
—
manipulate time structures
#include
<sys/time.h>
void
timerclear
(struct
timeval *a);
int
timerisset
(struct
timeval *a);
int
timerisvalid
(struct
timeval *a);
int
timercmp
(struct
timeval *a, struct
timeval *b,
operator);
void
timersub
(struct
timeval *a, struct
timeval *b, struct
timeval *c);
void
timeradd
(struct
timeval *a, struct
timeval *b, struct
timeval *c);
void
timespecclear
(struct
timespec *a);
int
timespecisset
(struct
timespec *a);
int
timespecisvalid
(struct
timespec *a);
int
timespeccmp
(struct
timespec *a, struct
timespec *b,
operator);
void
timespecsub
(struct
timespec *a, struct
timespec *b, struct
timespec *c);
void
timespecadd
(struct
timespec *a, struct
timespec *b, struct
timespec *c);
void
TIMEVAL_TO_TIMESPEC
(struct
timeval *tv, struct
timespec *ts);
void
TIMESPEC_TO_TIMEVAL
(struct
timeval *tv, struct
timespec *ts);
The
timer*
()
and
timespec*
()
macros defined in
<sys/time.h>
simplify the
use of timeval and timespec
structures, respectively.
The following macros are available:
timerclear
(a),
timespecclear
(a)timerisset
(a),
timespecisset
(a)timerisvalid
(a)timespecisvalid
(a)timercmp
(a,
b, operator),
timespeccmp
(a,
b, operator)<
,
<=
, ==
,
!=
, >=
, or
>
.timersub
(a,
b, c),
timespecsub
(a,
b, c)timeradd
(a,
b, c),
timespecadd
(a,
b, c)TIMEVAL_TO_TIMESPEC
(tv,
ts)TIMESPEC_TO_TIMEVAL
(tv,
ts)The macros returning int return 1 if the tested condition holds or 0 otherwise.
adjtime(2), clock_gettime(2), futex(2), futimens(2), futimes(2), getitimer(2), gettimeofday(2), kevent(2), nanosleep(2), ppoll(2), pselect(2)
These macros are non-standard, though many systems offer them. Similar interfaces are often available in their absence.
The macros timerclear
(),
timerisset
(), and timercmp
()
first appeared in 4.1cBSD,
TIMEVAL_TO_TIMESPEC
() and
TIMESPEC_TO_TIMEVAL
() in
4.4BSD, timersub
() and
timeradd
() in NetBSD 1.1,
and timerisvalid
() in OpenBSD
6.5.
The argument ordering for
TIMESPEC_TO_TIMEVAL
() is unintuitive.
May 10, 2019 | OpenBSD-6.8 |