1.\" $NetBSD: microuptime.9,v 1.10 2010/06/08 05:20:35 jruoho Exp $ 2.\" 3.\" Copyright (c) 2000 Kelly Yancey 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.\" $FreeBSD: src/share/man/man9/microuptime.9,v 1.7 2005/01/12 21:48:25 ru Exp $ 28.\" 29.Dd June 8, 2010 30.Dt MICROUPTIME 9 31.Os 32.Sh NAME 33.Nm binuptime , 34.Nm getbinuptime , 35.Nm microuptime , 36.Nm getmicrouptime , 37.Nm nanouptime , 38.Nm getnanouptime 39.Nd get the time elapsed since boot 40.Sh SYNOPSIS 41.In sys/time.h 42.Ft void 43.Fn binuptime "struct bintime *bt" 44.Ft void 45.Fn getbinuptime "struct bintime *bt" 46.Ft void 47.Fn microuptime "struct timeval *tv" 48.Ft void 49.Fn getmicrouptime "struct timeval *tv" 50.Ft void 51.Fn nanouptime "struct timespec *ts" 52.Ft void 53.Fn getnanouptime "struct timespec *tsp" 54.Sh DESCRIPTION 55The 56.Fn binuptime 57and 58.Fn getbinuptime 59functions store the time elapsed since boot as a 60.Vt "struct bintime" 61at the address specified by 62.Fa bt . 63The 64.Fn microuptime 65and 66.Fn getmicrouptime 67functions perform the same utility, but record the elapsed time as a 68.Vt "struct timeval" 69instead. 70Similarly the 71.Fn nanouptime 72and 73.Fn getnanouptime 74functions store the elapsed time as a 75.Vt "struct timespec" . 76The used structures are described in 77.Xr timeval 3 . 78.Pp 79The 80.Fn binuptime , 81.Fn microuptime , 82and 83.Fn nanouptime 84functions 85always query the timecounter to return the current time as precisely as 86possible. 87Whereas 88.Fn getbinuptime , 89.Fn getmicrouptime , 90and 91.Fn getnanouptime 92functions are abstractions which return a less precise, but 93faster to obtain, time. 94.Pp 95The intent of the 96.Fn getbinuptime , 97.Fn getmicrouptime , 98and 99.Fn getnanouptime 100functions is to enforce the user's preference for timer accuracy versus 101execution time. 102They should be used where a precision of 103.Pf 1/ Em HZ 104(e.g., 10 msec on a 105.Pf 100 Em HZ 106machine, see 107.Xr hz 9 ) 108is acceptable or where performance is priority. 109.Sh SEE ALSO 110.Xr microtime 9 , 111.Xr timecounter 9 , 112.Xr tvtohz 9 113.Sh AUTHORS 114This manual page was written by 115.An Kelly Yancey Aq kbyanc@posi.net . 116