1.\" $NetBSD: bintime_add.9,v 1.2 2010/06/08 07:20:20 wiz Exp $ 2.\" 3.\" Copyright (c) 2010 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Jukka Ruohonen. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28.\" POSSIBILITY OF SUCH DAMAGE. 29.\" 30.Dd June 8, 2010 31.Dt BINTIME_ADD 9 32.Os 33.Sh NAME 34.Nm bintime_add 35.Nd operations on 36.Dq bintime 37.Sh SYNOPSIS 38.In sys/time.h 39.Ft vid 40.Fn bintime_add "struct bintime *bt" "const struct bintime *bt2" 41.Ft void 42.Fn bintime_addx "struct bintime *bt" "uint64_t x" 43.Ft void 44.Fn bintime_sub "struct bintime *bt" "const struct bintime *bt2" 45.Ft void 46.Fn bintime2timespec "const struct bintime *bt" "struct timespec *ts" 47.Ft void 48.Fn timespec2bintime "const struct timespec *ts" "struct bintime *bt" 49.Ft void 50.Fn bintime2timeval "const struct bintime *bt" "struct timeval *tv" 51.Ft void 52.Fn timeval2bintime "const struct timeval *tv" "struct bintime *bt" 53.Sh DESCRIPTION 54These functions are provided for convenience as part of the machine-independent 55.Xr timecounter 9 56framework. 57All of them operate with the 58.Em bintime 59structure. 60.Pp 61The function 62.Fn bintime_add 63adds the time information stored in 64.Fa bt2 65to 66.Fa bt . 67Conversely, 68.Fn bintime_sub 69subtracts 70.Fa bt2 71from 72.Fa bt . 73The 74.Fn bintime_addx 75function stores the fraction of a second 76.Fa x 77to 78.Fa bt . 79.Pp 80Like the function names bespeak, 81.Fn bintime2timespec 82converts the 83.Em bintime 84structure to 85.Em struct timespec 86and 87.Fn timespec2bintime 88does the opposite. 89The functions 90.Fn bintime2timeval 91and 92.Fn timeval2bintime 93operate with 94.Em struct timeval 95instead. 96The result is stored to the right-hand side. 97.Sh SEE ALSO 98.Xr timeradd 3 , 99.Xr timeval 3 , 100.Xr bintime 9 , 101.Xr timecounter 9 102