Manual Page Result
0
Command: timeradd | Section: 3 | Source: OpenBSD | File: timeradd.3
TIMERADD(3) FreeBSD Library Functions Manual TIMERADD(3)
NAME
timerclear, timerisset, timerisvalid, timercmp, timersub, timeradd,
timespecclear, timespecisset, timespecisvalid, timespeccmp, timespecsub,
timespecadd, TIMEVAL_TO_TIMESPEC, TIMESPEC_TO_TIMEVAL - manipulate time
structures
SYNOPSIS
#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);
DESCRIPTION
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)
Set the time value in a to zero.
timerisset(a), timespecisset(a)
Test if the time value in a is non-zero.
timerisvalid(a)
Test if the microsecond value in a is greater than or equal to
zero and less than one million.
timespecisvalid(a)
Test if the nanosecond value in a is greater than or equal to
zero and less than one billion.
timercmp(a, b, operator), timespeccmp(a, b, operator)
Test if the expression a operator b is true, where operator is
one of <, <=, ==, !=, >=, or >.
timersub(a, b, c), timespecsub(a, b, c)
Subtract b from a and store the result in c.
timeradd(a, b, c), timespecadd(a, b, c)
Add b to a and store the result in c.
TIMEVAL_TO_TIMESPEC(tv, ts)
Convert tv to a struct timespec and store the result in ts.
TIMESPEC_TO_TIMEVAL(tv, ts)
Convert ts to a struct timeval and store the result in tv.
RETURN VALUES
The macros returning int return 1 if the tested condition holds or 0
otherwise.
SEE ALSO
adjtime(2), clock_gettime(2), futex(2), futimens(2), futimes(2),
getitimer(2), gettimeofday(2), kevent(2), nanosleep(2), ppoll(2),
pselect(2)
STANDARDS
These macros are non-standard, though many systems offer them. Similar
interfaces are often available in their absence.
HISTORY
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.
CAVEATS
The argument ordering for TIMESPEC_TO_TIMEVAL() is unintuitive.
FreeBSD 14.1-RELEASE-p8 May 10, 2019 FreeBSD 14.1-RELEASE-p8