TS2TIMO(9) | Kernel Developer's Manual | TS2TIMO(9)

# NAME

`ts2timo` —
convert time interval to tick count

# SYNOPSIS

`#include <sys/timevar.h>`

int
`ts2timo`(clock_id clock_id, int flags, struct timespec *ts, int *timo, struct timespec *start);

# DESCRIPTION

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 convert it to a relative time. If the start argument is not `NULL`, then current time for the clock_id clock is placed in that argument.

# RETURN VALUES

On success `ts2timo`() returns `0`. On failure it returns `ETIMEDOUT` if interval computed was `0` or negative, and `EINVAL` if ts->tv_usec field in the computed interval is out of range, or the clock_id argument is invalid.

# SEE ALSO

clock_gettime(2), clock_nanosleep(2)

# HISTORY

The `ts2timo` function first appeared in NetBSD 7.0.

May 22, 2013 | NetBSD 9.3