xref: /freebsd/share/man/man9/microtime.9 (revision f5463265955b829775bbb32e1fd0bc11dafc36ce)
1.\" Copyright (c) 2000 Kelly Yancey
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.Dd September 16, 2004
26.Dt MICROTIME 9
27.Os
28.Sh NAME
29.Nm bintime ,
30.Nm getbintime ,
31.Nm microtime ,
32.Nm getmicrotime ,
33.Nm nanotime ,
34.Nm getnanotime
35.Nd get the current time
36.Sh SYNOPSIS
37.In sys/time.h
38.Ft void
39.Fn bintime "struct bintime *bt"
40.Ft void
41.Fn getbintime "struct bintime *bt"
42.Ft void
43.Fn microtime "struct timeval *tv"
44.Ft void
45.Fn getmicrotime "struct timeval *tv"
46.Ft void
47.Fn nanotime "struct timespec *ts"
48.Ft void
49.Fn getnanotime "struct timespec *tsp"
50.Sh DESCRIPTION
51The
52.Fn bintime
53and
54.Fn getbintime
55functions store the system time as a
56.Vt "struct bintime"
57at the addresses specified by
58.Fa bt .
59The
60.Fn microtime
61and
62.Fn getmicrotime
63functions perform the same utility, but record the time as a
64.Vt "struct timeval"
65instead.
66Similarly the
67.Fn nanotime
68and
69.Fn getnanotime
70functions store the time as a
71.Vt "struct timespec" .
72.Pp
73The
74.Fn bintime ,
75.Fn microtime ,
76and
77.Fn nanotime
78functions
79always query the timecounter to return the current time as precisely as
80possible.
81Whereas
82.Fn getbintime ,
83.Fn getmicrotime ,
84and
85.Fn getnanotime
86functions are abstractions which return a less precise, but
87faster to obtain, time.
88.Pp
89The intent of the
90.Fn getbintime ,
91.Fn getmicrotime ,
92and
93.Fn getnanotime
94functions is to enforce the user's preference for timer accuracy versus
95execution time.
96.Sh SEE ALSO
97.Xr binuptime 9 ,
98.Xr getbinuptime 9 ,
99.Xr getmicrouptime 9 ,
100.Xr getnanouptime 9 ,
101.Xr microuptime 9 ,
102.Xr nanouptime 9 ,
103.Xr tvtohz 9
104.Sh HISTORY
105The
106.Nm bintime
107functions first appeared in
108.Fx 5.0 .
109The
110.Nm microtime
111and
112.Nm nanotime
113functions first appeared in
114.Fx 3.0
115but have existed in other incarnations since
116.Bx 4.4 .
117.Sh AUTHORS
118This manual page was written by
119.An Kelly Yancey Aq Mt kbyanc@posi.net .
120