timeradd.3 (89320) | timeradd.3 (92596) |
---|---|
1.\" Copyright (c) 1999 Kelly Yancey <kbyanc@posi.net> 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. --- 11 unchanged lines hidden (view full) --- 20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26.\" SUCH DAMAGE. 27.\" | 1.\" Copyright (c) 1999 Kelly Yancey <kbyanc@posi.net> 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. --- 11 unchanged lines hidden (view full) --- 20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26.\" SUCH DAMAGE. 27.\" |
28.\" $FreeBSD: head/share/man/man3/timeradd.3 89320 2002-01-14 00:38:20Z dwhite $ | 28.\" $FreeBSD: head/share/man/man3/timeradd.3 92596 2002-03-18 16:18:33Z ru $ |
29.\" | 29.\" |
30.Dd Aug 11, 1999 | 30.Dd August 11, 1999 |
31.Dt TIMERADD 3 | 31.Dt TIMERADD 3 |
32.Os BSD 4 | 32.Os |
33.Sh NAME 34.Nm timeradd , 35.Nm timersub , 36.Nm timerclear , 37.Nm timerisset , 38.Nm timercmp 39.Nd operations on timevals 40.Sh SYNOPSIS | 33.Sh NAME 34.Nm timeradd , 35.Nm timersub , 36.Nm timerclear , 37.Nm timerisset , 38.Nm timercmp 39.Nd operations on timevals 40.Sh SYNOPSIS |
41.Fd #include <sys/time.h> 42.Fn timeradd "&tvp" "&uvp" "&vvp" 43.Fn timersub "&tvp" "&uvp" "&vvp" 44.Fn timerclear "&tvp" 45.Fn timerisset "&tvp" 46.Fn timercmp "&tvp" "&uvp" "cmp" | 41.In sys/time.h 42.Ft void 43.Fn timeradd "struct timeval *a" "struct timeval *b" "struct timeval *res" 44.Ft void 45.Fn timersub "struct timeval *a" "struct timeval *b" "struct timeval *res" 46.Ft void 47.Fn timerclear "struct timeval *tvp" 48.Ft int 49.Fn timerisset "struct timeval *tvp" 50.Ft int 51.Fn timercmp "struct timeval *a" "struct timeval *b" CMP |
47.Sh DESCRIPTION | 52.Sh DESCRIPTION |
48.Pp | |
49These macros are provided for manipulating 50.Fa timeval 51structures for use with the | 53These macros are provided for manipulating 54.Fa timeval 55structures for use with the |
52.Fn gettimeofday | 56.Xr gettimeofday 2 |
53and | 57and |
54.Fn settimeofday | 58.Xr settimeofday 2 |
55calls. | 59calls. |
56The structures pointed to by 57.Fa tvp , 58.Fa uvp , 59and 60.Fa vvp 61are defined in 62.Ao Pa sys/time.h Ac | 60The structure is defined in 61.Aq Pa sys/time.h |
63as: | 62as: |
64.Pp | |
65.Bd -literal 66struct timeval { 67 long tv_sec; /* seconds since Jan. 1, 1970 */ 68 long tv_usec; /* and microseconds */ 69}; 70.Ed 71.Pp 72.Fn timeradd 73adds the time information stored in | 63.Bd -literal 64struct timeval { 65 long tv_sec; /* seconds since Jan. 1, 1970 */ 66 long tv_usec; /* and microseconds */ 67}; 68.Ed 69.Pp 70.Fn timeradd 71adds the time information stored in |
74.Fa uvp | 72.Fa a |
75to | 73to |
76.Fa tvp | 74.Fa b |
77and stores the resulting | 75and stores the resulting |
78.Fa timeval | 76.Vt timeval |
79in | 77in |
80.Fa vvp . | 78.Fa res . |
81The results are simplified such that the value of | 79The results are simplified such that the value of |
82.Fa vvp->tv_usec | 80.Fa res->tv_usec |
83is always less than 1,000,000 (1 second). 84.Pp 85.Fn timersub 86subtracts the time information stored in | 81is always less than 1,000,000 (1 second). 82.Pp 83.Fn timersub 84subtracts the time information stored in |
87.Fa uvp | 85.Fa b |
88from | 86from |
89.Fa tvp | 87.Fa a |
90and stores the resulting | 88and stores the resulting |
91.Fa timeval | 89.Vt timeval |
92in | 90in |
93.Fa vvp . | 91.Fa res . |
94.Pp 95.Fn timerclear 96initializes 97.Fa tvp 98to midnight (0 hour) January 1st, 1970 (the Epoch). 99.Pp 100.Fn timerisset 101returns true if 102.Fa tvp 103is set to any time value other than the Epoch. 104.Pp 105.Fn timercmp 106compares | 92.Pp 93.Fn timerclear 94initializes 95.Fa tvp 96to midnight (0 hour) January 1st, 1970 (the Epoch). 97.Pp 98.Fn timerisset 99returns true if 100.Fa tvp 101is set to any time value other than the Epoch. 102.Pp 103.Fn timercmp 104compares |
107.Fa tvp | 105.Fa a |
108to | 106to |
109.Fa uvp | 107.Fa b |
110using the comparison operator given in | 108using the comparison operator given in |
111.Fa cmp | 109.Fa CMP , |
112and returns the result of that comparison. 113.Sh SEE ALSO | 110and returns the result of that comparison. 111.Sh SEE ALSO |
114.Xr gettimeofday 2 | 112.Xr gettimeofday 2 |
115.Sh HISTORY 116The 117.Fn timeradd 118family of macros were imported from 119.Nx 1.1 , 120and appeared in 121.Fx 2.2.6 . | 113.Sh HISTORY 114The 115.Fn timeradd 116family of macros were imported from 117.Nx 1.1 , 118and appeared in 119.Fx 2.2.6 . |