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.\" $FreeBSD$ 26.\" 27.Dd February 21, 2015 28.Dt MICROUPTIME 9 29.Os 30.Sh NAME 31.Nm binuptime , 32.Nm getbinuptime , 33.Nm microuptime , 34.Nm getmicrouptime , 35.Nm nanouptime , 36.Nm getnanouptime , 37.Nm sbinuptime , 38.Nm getsbinuptime 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.Ft sbintime_t 55.Fn sbinuptime "void" 56.Ft sbintime_t 57.Fn getsbinuptime "void" 58.Sh DESCRIPTION 59The 60.Fn binuptime 61and 62.Fn getbinuptime 63functions store the time elapsed since boot as a 64.Vt "struct bintime" 65at the address specified by 66.Fa bt . 67The 68.Fn microuptime 69and 70.Fn getmicrouptime 71functions perform the same utility, but record the elapsed time as a 72.Vt "struct timeval" 73instead. 74Similarly the 75.Fn nanouptime 76and 77.Fn getnanouptime 78functions store the elapsed time as a 79.Vt "struct timespec" . 80The 81.Fn sbinuptime 82and 83.Fn getsbinuptime 84functions return the time elapsed since boot as a 85.Vt "sbintime_t" . 86.Pp 87The 88.Fn binuptime , 89.Fn microuptime , 90.Fn nanouptime , 91and 92.Fn sbinuptime 93functions 94always query the timecounter to return the current time as precisely as 95possible. 96Whereas 97.Fn getbinuptime , 98.Fn getmicrouptime , 99.Fn getnanouptime , 100and 101.Fn getsbinuptime 102functions are abstractions which return a less precise, but 103faster to obtain, time. 104.Pp 105The intent of the 106.Fn getbinuptime , 107.Fn getmicrouptime , 108.Fn getnanouptime , 109and 110.Fn getsbinuptime 111functions is to enforce the user's preference for timer accuracy versus 112execution time. 113.Sh SEE ALSO 114.Xr bintime 9 , 115.Xr get_cyclecount 9 , 116.Xr getbintime 9 , 117.Xr getmicrotime 9 , 118.Xr getnanotime 9 , 119.Xr microtime 9 , 120.Xr nanotime 9 , 121.Xr tvtohz 9 122.Sh AUTHORS 123This manual page was written by 124.An Kelly Yancey Aq Mt kbyanc@posi.net . 125