2010-06-08 11:20:20 +04:00
|
|
|
.\" $NetBSD: bintime_add.9,v 1.2 2010/06/08 07:20:20 wiz Exp $
|
2010-06-08 09:40:26 +04:00
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 2010 The NetBSD Foundation, Inc.
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
.\" by Jukka Ruohonen.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.Dd June 8, 2010
|
|
|
|
.Dt BINTIME_ADD 9
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm bintime_add
|
|
|
|
.Nd operations on
|
|
|
|
.Dq bintime
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.In sys/time.h
|
|
|
|
.Ft vid
|
|
|
|
.Fn bintime_add "struct bintime *bt" "const struct bintime *bt2"
|
|
|
|
.Ft void
|
|
|
|
.Fn bintime_addx "struct bintime *bt" "uint64_t x"
|
|
|
|
.Ft void
|
|
|
|
.Fn bintime_sub "struct bintime *bt" "const struct bintime *bt2"
|
|
|
|
.Ft void
|
|
|
|
.Fn bintime2timespec "const struct bintime *bt" "struct timespec *ts"
|
|
|
|
.Ft void
|
|
|
|
.Fn timespec2bintime "const struct timespec *ts" "struct bintime *bt"
|
|
|
|
.Ft void
|
|
|
|
.Fn bintime2timeval "const struct bintime *bt" "struct timeval *tv"
|
|
|
|
.Ft void
|
|
|
|
.Fn timeval2bintime "const struct timeval *tv" "struct bintime *bt"
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
These functions are provided for convenience as part of the machine-independent
|
|
|
|
.Xr timecounter 9
|
|
|
|
framework.
|
|
|
|
All of them operate with the
|
|
|
|
.Em bintime
|
|
|
|
structure.
|
|
|
|
.Pp
|
|
|
|
The function
|
|
|
|
.Fn bintime_add
|
|
|
|
adds the time information stored in
|
|
|
|
.Fa bt2
|
|
|
|
to
|
|
|
|
.Fa bt .
|
|
|
|
Conversely,
|
|
|
|
.Fn bintime_sub
|
|
|
|
subtracts
|
|
|
|
.Fa bt2
|
|
|
|
from
|
|
|
|
.Fa bt .
|
|
|
|
The
|
|
|
|
.Fn bintime_addx
|
|
|
|
function stores the fraction of a second
|
|
|
|
.Fa x
|
|
|
|
to
|
|
|
|
.Fa bt .
|
|
|
|
.Pp
|
|
|
|
Like the function names bespeak,
|
|
|
|
.Fn bintime2timespec
|
|
|
|
converts the
|
|
|
|
.Em bintime
|
|
|
|
structure to
|
|
|
|
.Em struct timespec
|
|
|
|
and
|
|
|
|
.Fn timespec2bintime
|
|
|
|
does the opposite.
|
|
|
|
The functions
|
|
|
|
.Fn bintime2timeval
|
|
|
|
and
|
|
|
|
.Fn timeval2bintime
|
|
|
|
operate with
|
|
|
|
.Em struct timeval
|
|
|
|
instead.
|
|
|
|
The result is stored to the right-hand side.
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr timeradd 3 ,
|
|
|
|
.Xr timeval 3 ,
|
|
|
|
.Xr bintime 9 ,
|
2010-06-08 11:20:20 +04:00
|
|
|
.Xr timecounter 9
|