.\" Copyright (c) 2000 Kelly Yancey .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD: src/share/man/man9/tvtohz.9,v 1.1.4.2 2001/12/17 11:30:19 ru Exp $ .\" $DragonFly: src/share/man/man9/tvtohz.9,v 1.4 2007/11/14 18:27:52 swildner Exp $ .\" .Dd June 30, 2007 .Dt TVTOHZ 9 .Os .Sh NAME .Nm tvtohz_high , .Nm tvtohz_low .Nd convert time interval to tick count .Sh SYNOPSIS .In sys/time.h .Ft int .Fn tvtohz_high "struct timeval *tv" .Ft int .Fn tvtohz_low "struct timeval *tv" .Sh DESCRIPTION The .Fn tvtohz_high and .Fn tvtohz_low functions accept a single argument .Fa tv which specifies the time interval over which to calculate the number of system ticks that would elapse. .Sh RETURN VALUES The .Fn 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. .Pp The .Fn tvtohz_low function returns the uncompensated number of system ticks for the specified amount of time. A return value of 0 is possible if .Fa tv converts to less than 1 tick. .Pp If the reprensentation overflows, both functions return .Dv INT_MAX . .Sh FILES .Pa sys/kern/kern_clock.c .Sh SEE ALSO .Xr callout 9 , .Xr microtime 9 , .Xr microuptime 9 .Sh HISTORY The .Nm tvtohz function first appeared in .Fx 3.0 . It was split into .Nm and .Nm tvtohz_low by .An Matt Dillon in .Dx 1.0 . .Sh AUTHORS .An -nosplit This manual page was originally written by .An Kelly Yancey Aq kbyanc@posi.net and later updated by .An Sascha Wildner .