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
  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.
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.
The ts2timo function first appeared in
  NetBSD 7.0.