xref: /freebsd/share/man/man9/microtime.9 (revision 10ebc7c038c47bf660d9c4c17d43ad56e45fe6c9)
1ae5ccfadSAlexey Zelkin.\" Copyright (c) 2000 Kelly Yancey
2ae5ccfadSAlexey Zelkin.\" All rights reserved.
3ae5ccfadSAlexey Zelkin.\"
4ae5ccfadSAlexey Zelkin.\" Redistribution and use in source and binary forms, with or without
5ae5ccfadSAlexey Zelkin.\" modification, are permitted provided that the following conditions
6ae5ccfadSAlexey Zelkin.\" are met:
7ae5ccfadSAlexey Zelkin.\" 1. Redistributions of source code must retain the above copyright
8ae5ccfadSAlexey Zelkin.\"    notice, this list of conditions and the following disclaimer.
9ae5ccfadSAlexey Zelkin.\" 2. Redistributions in binary form must reproduce the above copyright
10ae5ccfadSAlexey Zelkin.\"    notice, this list of conditions and the following disclaimer in the
11ae5ccfadSAlexey Zelkin.\"    documentation and/or other materials provided with the distribution.
12ae5ccfadSAlexey Zelkin.\"
13ae5ccfadSAlexey Zelkin.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14ae5ccfadSAlexey Zelkin.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15ae5ccfadSAlexey Zelkin.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16ae5ccfadSAlexey Zelkin.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17ae5ccfadSAlexey Zelkin.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18ae5ccfadSAlexey Zelkin.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19ae5ccfadSAlexey Zelkin.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20ae5ccfadSAlexey Zelkin.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21ae5ccfadSAlexey Zelkin.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22ae5ccfadSAlexey Zelkin.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23ae5ccfadSAlexey Zelkin.\" SUCH DAMAGE.
24ae5ccfadSAlexey Zelkin.\"
25ae5ccfadSAlexey Zelkin.\" $FreeBSD$
26ae5ccfadSAlexey Zelkin.\"
2735779bdbSBrooks Davis.Dd September 16, 2004
28ae5ccfadSAlexey Zelkin.Dt MICROTIME 9
293d45e180SRuslan Ermilov.Os
30ae5ccfadSAlexey Zelkin.Sh NAME
3135779bdbSBrooks Davis.Nm bintime ,
3235779bdbSBrooks Davis.Nm getbintime ,
33ae5ccfadSAlexey Zelkin.Nm microtime ,
34ae5ccfadSAlexey Zelkin.Nm getmicrotime ,
35ae5ccfadSAlexey Zelkin.Nm nanotime ,
36ae5ccfadSAlexey Zelkin.Nm getnanotime
37ae5ccfadSAlexey Zelkin.Nd get the current time
38ae5ccfadSAlexey Zelkin.Sh SYNOPSIS
3932eef9aeSRuslan Ermilov.In sys/time.h
40ae5ccfadSAlexey Zelkin.Ft void
4135779bdbSBrooks Davis.Fn bintime "struct bintime *bt"
4235779bdbSBrooks Davis.Ft void
4335779bdbSBrooks Davis.Fn getbintime "struct bintime *bt"
4435779bdbSBrooks Davis.Ft void
45ae5ccfadSAlexey Zelkin.Fn microtime "struct timeval *tv"
46ae5ccfadSAlexey Zelkin.Ft void
47ae5ccfadSAlexey Zelkin.Fn getmicrotime "struct timeval *tv"
48ae5ccfadSAlexey Zelkin.Ft void
49ae5ccfadSAlexey Zelkin.Fn nanotime "struct timespec *ts"
50ae5ccfadSAlexey Zelkin.Ft void
51ae5ccfadSAlexey Zelkin.Fn getnanotime "struct timespec *tsp"
52ae5ccfadSAlexey Zelkin.Sh DESCRIPTION
53ae5ccfadSAlexey ZelkinThe
5435779bdbSBrooks Davis.Fn bintime
5535779bdbSBrooks Davisand
5635779bdbSBrooks Davis.Fn getbintime
5735779bdbSBrooks Davisfunctions store the system time as a
58c0854fb7SRuslan Ermilov.Vt "struct bintime"
5935779bdbSBrooks Davisat the addresses specified by
6035779bdbSBrooks Davis.Fa bt .
6135779bdbSBrooks DavisThe
62ae5ccfadSAlexey Zelkin.Fn microtime
63ae5ccfadSAlexey Zelkinand
64ae5ccfadSAlexey Zelkin.Fn getmicrotime
6535779bdbSBrooks Davisfunctions perform the same utility, but record the time as a
66c0854fb7SRuslan Ermilov.Vt "struct timeval"
6735779bdbSBrooks Davisinstead.
6835779bdbSBrooks DavisSimilarly the
69ae5ccfadSAlexey Zelkin.Fn nanotime
70ae5ccfadSAlexey Zelkinand
71ae5ccfadSAlexey Zelkin.Fn getnanotime
7235779bdbSBrooks Davisfunctions store the time as a
73c0854fb7SRuslan Ermilov.Vt "struct timespec" .
74ae5ccfadSAlexey Zelkin.Pp
75c0854fb7SRuslan ErmilovThe
76c0854fb7SRuslan Ermilov.Fn bintime ,
7735779bdbSBrooks Davis.Fn microtime ,
78ae5ccfadSAlexey Zelkinand
79ae5ccfadSAlexey Zelkin.Fn nanotime
80c0854fb7SRuslan Ermilovfunctions
81ae5ccfadSAlexey Zelkinalways query the timecounter to return the current time as precisely as
821111b49cSSheldon Hearnpossible.
831111b49cSSheldon HearnWhereas
8435779bdbSBrooks Davis.Fn getbintime ,
8535779bdbSBrooks Davis.Fn getmicrotime ,
86ae5ccfadSAlexey Zelkinand
87ae5ccfadSAlexey Zelkin.Fn getnanotime
881e42415dSMark Murrayfunctions are abstractions which return a less precise, but
891111b49cSSheldon Hearnfaster to obtain, time.
90ae5ccfadSAlexey Zelkin.Pp
91ae5ccfadSAlexey ZelkinThe intent of the
9235779bdbSBrooks Davis.Fn getbintime ,
9335779bdbSBrooks Davis.Fn getmicrotime ,
94ae5ccfadSAlexey Zelkinand
95ae5ccfadSAlexey Zelkin.Fn getnanotime
96ae5ccfadSAlexey Zelkinfunctions is to enforce the user's preference for timer accuracy versus
97ae5ccfadSAlexey Zelkinexecution time.
98ae5ccfadSAlexey Zelkin.Sh SEE ALSO
9935779bdbSBrooks Davis.Xr binuptime 9 ,
10035779bdbSBrooks Davis.Xr getbinuptime 9 ,
101ae5ccfadSAlexey Zelkin.Xr getmicrouptime 9 ,
102ae5ccfadSAlexey Zelkin.Xr getnanouptime 9 ,
103ae5ccfadSAlexey Zelkin.Xr microuptime 9 ,
104ae5ccfadSAlexey Zelkin.Xr nanouptime 9 ,
105ae5ccfadSAlexey Zelkin.Xr tvtohz 9
106ae5ccfadSAlexey Zelkin.Sh HISTORY
107ae5ccfadSAlexey ZelkinThe
10835779bdbSBrooks Davis.Nm bintime
10935779bdbSBrooks Davisfunctions first appeared in
11035779bdbSBrooks Davis.Fx 5.0 .
11135779bdbSBrooks DavisThe
11210ebc7c0SJohn Baldwin.Nm microtime
113ae5ccfadSAlexey Zelkinand
114ae5ccfadSAlexey Zelkin.Nm nanotime
115ae5ccfadSAlexey Zelkinfunctions first appeared in
116ae5ccfadSAlexey Zelkin.Fx 3.0
11710ebc7c0SJohn Baldwinbut have existed in other incarnations since
11835779bdbSBrooks Davis.Bx 4.4 .
119ae5ccfadSAlexey Zelkin.Sh AUTHORS
120ae5ccfadSAlexey ZelkinThis manual page was written by
121ae5ccfadSAlexey Zelkin.An Kelly Yancey Aq kbyanc@posi.net .
122