TVTOHZ(9)

NAME
tvtohz_high, tvtohz_low - convert time interval to tick count

SYNOPSIS
#include <sys/time.h>
int
tvtohz_high(struct timeval *tv);
int
tvtohz_low(struct timeval *tv);

DESCRIPTION
The tvtohz_high() and tvtohz_low() functions accept a single argument tv which specifies the time interval over which to calculate the number of system ticks that would elapse.

RETURN VALUES
The tvtohz_high() function returns the integral number of system ticks expected to elapse in the given interval. The return value is intended to be used in a clock interrupt timed operation and guaranteed to meet or exceed the requested time. The minimum return value is 1 tick and the function will average the calculation up. If any value greater than 0 microseconds is supplied, a value of at least 2 will be returned to ensure that a near-term clock interrupt does not cause the timeout to occur (degenerately) early.

The tvtohz_low() function returns the uncompensated number of system ticks for the specified amount of time. A return value of 0 is possible if tv converts to less than 1 tick.

If the reprensentation overflows, both functions return INT_MAX.

FILES
sys/kern/kern_clock.c

SEE ALSO
callout(9), microtime(9), microuptime(9)

HISTORY
The tvtohz function first appeared in FreeBSD 3.0. It was split into tvtohz_high and tvtohz_low by Matt Dillon in DragonFly 1.0.

AUTHORS
-nosplit This manual page was originally written by Kelly Yancey <kbyanc@posi.net> and later updated by Sascha Wildner.