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