xref: /freebsd/share/man/man9/microtime.9 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
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.\"
2535779bdbSBrooks Davis.Dd September 16, 2004
26ae5ccfadSAlexey Zelkin.Dt MICROTIME 9
273d45e180SRuslan Ermilov.Os
28ae5ccfadSAlexey Zelkin.Sh NAME
2935779bdbSBrooks Davis.Nm bintime ,
3035779bdbSBrooks Davis.Nm getbintime ,
31ae5ccfadSAlexey Zelkin.Nm microtime ,
32ae5ccfadSAlexey Zelkin.Nm getmicrotime ,
33ae5ccfadSAlexey Zelkin.Nm nanotime ,
34ae5ccfadSAlexey Zelkin.Nm getnanotime
35ae5ccfadSAlexey Zelkin.Nd get the current time
36ae5ccfadSAlexey Zelkin.Sh SYNOPSIS
3732eef9aeSRuslan Ermilov.In sys/time.h
38ae5ccfadSAlexey Zelkin.Ft void
3935779bdbSBrooks Davis.Fn bintime "struct bintime *bt"
4035779bdbSBrooks Davis.Ft void
4135779bdbSBrooks Davis.Fn getbintime "struct bintime *bt"
4235779bdbSBrooks Davis.Ft void
43ae5ccfadSAlexey Zelkin.Fn microtime "struct timeval *tv"
44ae5ccfadSAlexey Zelkin.Ft void
45ae5ccfadSAlexey Zelkin.Fn getmicrotime "struct timeval *tv"
46ae5ccfadSAlexey Zelkin.Ft void
47ae5ccfadSAlexey Zelkin.Fn nanotime "struct timespec *ts"
48ae5ccfadSAlexey Zelkin.Ft void
49ae5ccfadSAlexey Zelkin.Fn getnanotime "struct timespec *tsp"
50ae5ccfadSAlexey Zelkin.Sh DESCRIPTION
51ae5ccfadSAlexey ZelkinThe
5235779bdbSBrooks Davis.Fn bintime
5335779bdbSBrooks Davisand
5435779bdbSBrooks Davis.Fn getbintime
5535779bdbSBrooks Davisfunctions store the system time as a
56c0854fb7SRuslan Ermilov.Vt "struct bintime"
5735779bdbSBrooks Davisat the addresses specified by
5835779bdbSBrooks Davis.Fa bt .
5935779bdbSBrooks DavisThe
60ae5ccfadSAlexey Zelkin.Fn microtime
61ae5ccfadSAlexey Zelkinand
62ae5ccfadSAlexey Zelkin.Fn getmicrotime
6335779bdbSBrooks Davisfunctions perform the same utility, but record the time as a
64c0854fb7SRuslan Ermilov.Vt "struct timeval"
6535779bdbSBrooks Davisinstead.
6635779bdbSBrooks DavisSimilarly the
67ae5ccfadSAlexey Zelkin.Fn nanotime
68ae5ccfadSAlexey Zelkinand
69ae5ccfadSAlexey Zelkin.Fn getnanotime
7035779bdbSBrooks Davisfunctions store the time as a
71c0854fb7SRuslan Ermilov.Vt "struct timespec" .
72ae5ccfadSAlexey Zelkin.Pp
73c0854fb7SRuslan ErmilovThe
74c0854fb7SRuslan Ermilov.Fn bintime ,
7535779bdbSBrooks Davis.Fn microtime ,
76ae5ccfadSAlexey Zelkinand
77ae5ccfadSAlexey Zelkin.Fn nanotime
78c0854fb7SRuslan Ermilovfunctions
79ae5ccfadSAlexey Zelkinalways query the timecounter to return the current time as precisely as
801111b49cSSheldon Hearnpossible.
811111b49cSSheldon HearnWhereas
8235779bdbSBrooks Davis.Fn getbintime ,
8335779bdbSBrooks Davis.Fn getmicrotime ,
84ae5ccfadSAlexey Zelkinand
85ae5ccfadSAlexey Zelkin.Fn getnanotime
861e42415dSMark Murrayfunctions are abstractions which return a less precise, but
871111b49cSSheldon Hearnfaster to obtain, time.
88ae5ccfadSAlexey Zelkin.Pp
89ae5ccfadSAlexey ZelkinThe intent of the
9035779bdbSBrooks Davis.Fn getbintime ,
9135779bdbSBrooks Davis.Fn getmicrotime ,
92ae5ccfadSAlexey Zelkinand
93ae5ccfadSAlexey Zelkin.Fn getnanotime
94ae5ccfadSAlexey Zelkinfunctions is to enforce the user's preference for timer accuracy versus
95ae5ccfadSAlexey Zelkinexecution time.
96ae5ccfadSAlexey Zelkin.Sh SEE ALSO
9735779bdbSBrooks Davis.Xr binuptime 9 ,
9835779bdbSBrooks Davis.Xr getbinuptime 9 ,
99ae5ccfadSAlexey Zelkin.Xr getmicrouptime 9 ,
100ae5ccfadSAlexey Zelkin.Xr getnanouptime 9 ,
101ae5ccfadSAlexey Zelkin.Xr microuptime 9 ,
102ae5ccfadSAlexey Zelkin.Xr nanouptime 9 ,
103ae5ccfadSAlexey Zelkin.Xr tvtohz 9
104ae5ccfadSAlexey Zelkin.Sh HISTORY
105ae5ccfadSAlexey ZelkinThe
10635779bdbSBrooks Davis.Nm bintime
10735779bdbSBrooks Davisfunctions first appeared in
10835779bdbSBrooks Davis.Fx 5.0 .
10935779bdbSBrooks DavisThe
11010ebc7c0SJohn Baldwin.Nm microtime
111ae5ccfadSAlexey Zelkinand
112ae5ccfadSAlexey Zelkin.Nm nanotime
113ae5ccfadSAlexey Zelkinfunctions first appeared in
114ae5ccfadSAlexey Zelkin.Fx 3.0
11510ebc7c0SJohn Baldwinbut have existed in other incarnations since
11635779bdbSBrooks Davis.Bx 4.4 .
117ae5ccfadSAlexey Zelkin.Sh AUTHORS
118ae5ccfadSAlexey ZelkinThis manual page was written by
119*8a7314fcSBaptiste Daroussin.An Kelly Yancey Aq Mt kbyanc@posi.net .
120