ts2timo
—
convert time interval to tick count
#include <sys/timevar.h>
int
ts2timo
(clock_id
clock_id, int
flags, struct timespec
*ts, int *timo,
struct timespec
*start);
The ts2timo
() function converts the time interval
specified in ts into the integral number of system ticks
that would elapse (including the current tick) and places the result in
timo. The interval type is specified in the
flags argument and can be either
TIMER_ABSTIME
or
TIMER_RELTIME
. If the interval is specified as an
absolute time, then the clock_id clock is used to
calculate the corresponding relative time. If the start
argument is not NULL
, then current time for the
clock_id clock is placed in that argument.
On success ts2timo
() returns 0
,
and places the computed number of ticks in the integer referenced by
timo. On failure it returns
ETIMEDOUT
if interval computed was
0
or negative, or EINVAL
if
the ts->tv_nsec field is out of range, or the
clock_id argument is invalid, or if computing the
relative time from a supplied absolute value would cause an arithmetic
overflow.
The ts2timo
function first appeared in
NetBSD 7.0.