86 lines
2.6 KiB
Groff
86 lines
2.6 KiB
Groff
.\" $NetBSD: ts2timo.9,v 1.3 2013/05/24 14:41:32 njoly Exp $
|
|
.\"
|
|
.\" Copyright (c) 2013 Christos Zoulas
|
|
.\" 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.
|
|
.\"
|
|
.\"
|
|
.Dd May 22, 2013
|
|
.Dt TS2TIMO 9
|
|
.Os
|
|
.Sh NAME
|
|
.Nm ts2timo
|
|
.Nd convert time interval to tick count
|
|
.Sh SYNOPSIS
|
|
.In sys/timevar.h
|
|
.Ft int
|
|
.Fn ts2timo "clock_id clock_id" "int flags" "struct timespec *ts" "int *timo" "struct timespec *start"
|
|
.Sh DESCRIPTION
|
|
The
|
|
.Fn ts2timo
|
|
function converts the time interval specified in
|
|
.Fa ts
|
|
into the integral number of system ticks that would elapse (including the
|
|
current tick) and places the result in
|
|
.Fa timo .
|
|
The interval type is specified in the
|
|
.Fa flags
|
|
argument and can be either
|
|
.Dv TIMER_ABSTIME
|
|
or
|
|
.Dv TIMER_RELTIME .
|
|
If the interval is specified as an absolute time, then the
|
|
.Fa clock_id
|
|
clock is used to convert it to a relative time.
|
|
If the
|
|
.Fa start
|
|
argument is not
|
|
.Dv NULL ,
|
|
then current time for the
|
|
.Fa clock_id
|
|
clock is placed in that argument.
|
|
.Sh RETURN VALUES
|
|
On success
|
|
.Fn ts2timo
|
|
returns
|
|
.Dv 0 .
|
|
On failure it returns
|
|
.Er ETIMEDOUT
|
|
if interval computed was
|
|
.Dv 0
|
|
or negative, and
|
|
.Er EINVAL
|
|
if
|
|
.Fa ts->tv_usec
|
|
field in the computed interval is out of range, or the
|
|
.Fa clock_id
|
|
argument is invalid.
|
|
.Sh SEE ALSO
|
|
.Xr clock_gettime 2 ,
|
|
.Xr clock_nanosleep 2
|
|
.Sh HISTORY
|
|
The
|
|
.Nm
|
|
function first appeared in
|
|
.Nx 7.0 .
|