xref: /netbsd-src/share/man/man9/ts2timo.9 (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1.\"	$NetBSD: ts2timo.9,v 1.3 2013/05/24 14:41:32 njoly Exp $
2.\"
3.\" Copyright (c) 2013 Christos Zoulas
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.\"
28.Dd May 22, 2013
29.Dt TS2TIMO 9
30.Os
31.Sh NAME
32.Nm ts2timo
33.Nd convert time interval to tick count
34.Sh SYNOPSIS
35.In sys/timevar.h
36.Ft int
37.Fn ts2timo "clock_id clock_id" "int flags" "struct timespec *ts" "int *timo" "struct timespec *start"
38.Sh DESCRIPTION
39The
40.Fn ts2timo
41function converts the time interval specified in
42.Fa ts
43into the integral number of system ticks that would elapse (including the
44current tick) and places the result in
45.Fa timo .
46The interval type is specified in the
47.Fa flags
48argument and can be either
49.Dv TIMER_ABSTIME
50or
51.Dv TIMER_RELTIME .
52If the interval is specified as an absolute time, then the
53.Fa clock_id
54clock is used to convert it to a relative time.
55If the
56.Fa start
57argument is not
58.Dv NULL ,
59then current time for the
60.Fa clock_id
61clock is placed in that argument.
62.Sh RETURN VALUES
63On success
64.Fn ts2timo
65returns
66.Dv 0 .
67On failure it returns
68.Er ETIMEDOUT
69if  interval computed was
70.Dv 0
71or negative, and
72.Er EINVAL
73if
74.Fa ts->tv_usec
75field in the computed interval is out of range, or the
76.Fa clock_id
77argument is invalid.
78.Sh SEE ALSO
79.Xr clock_gettime 2 ,
80.Xr clock_nanosleep 2
81.Sh HISTORY
82The
83.Nm
84function first appeared in
85.Nx 7.0 .
86