| BINTIMEADD(9) | Kernel Developer's Manual | BINTIMEADD(9) |
bintimecmp,
bintimesub, bintimeadd,
bintimeaddfrac,
BINTIME_TO_TIMEVAL,
BINTIME_TO_TIMESPEC,
TIMEVAL_TO_BINTIME,
TIMESPEC_TO_BINTIME —
manipulate kernel time structures
#include
<sys/time.h>
int
bintimecmp(struct bintime *a,
struct bintime *b,
operator);
void
bintimesub(const struct bintime
*a, const struct bintime *b,
struct bintime *c);
void
bintimeadd(const struct bintime
*a, const struct bintime *b,
struct bintime *c);
void
bintimeaddfrac(const struct bintime
*a, uint64_t fraction, struct
bintime *b);
void
BINTIME_TO_TIMEVAL(const struct
bintime *bt, struct timeval *tv);
void
BINTIME_TO_TIMESPEC(const struct
bintime *bt, struct timespec *ts);
void
TIMEVAL_TO_BINTIME(const struct
timeval *tv, struct bintime *bt);
void
TIMESPEC_TO_BINTIME(const struct
timespec *ts, struct bintime *bt);
These functions simplify the use of bintime structures and the conversion to and from other time representations.
The following functions are available:
bintimecmp(a,
b, operator)<,
<=, ==,
!=, >=, or
>.bintimesub(a,
b, c)bintimeadd(a,
b, c)bintimeaddfrac(a,
fraction, b)BINTIME_TO_TIMEVAL(bt,
tv)BINTIME_TO_TIMESPEC(bt,
ts)TIMEVAL_TO_BINTIME(tv,
bt)TIMESPEC_TO_BINTIME(ts,
bt)bintimecmp() returns 1 if the tested
condition holds or 0 otherwise.
These functions are implemented in the file sys/sys/time.h.
Predecessors to these functions first appeared in FreeBSD 5.0 and were ported to OpenBSD 3.6. They were modified to more closely resemble the timeradd(3) macros for OpenBSD 6.6.
Poul-Henning Kamp <phk@freebsd.org>
| June 3, 2019 | Debian |