| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | .\" $NetBSD: timeval.3,v 1.11 2010/06/08 05:50:01 jruoho Exp $ | | 1 | .\" $NetBSD: timeval.3,v 1.12 2011/04/12 08:39:26 jruoho Exp $ |
2 | .\" | | 2 | .\" |
3 | .\" Copyright (c) 2010 The NetBSD Foundation, Inc. | | 3 | .\" Copyright (c) 2010 The NetBSD Foundation, Inc. |
4 | .\" All rights reserved. | | 4 | .\" All rights reserved. |
5 | .\" | | 5 | .\" |
6 | .\" This code is derived from software contributed to The NetBSD Foundation | | 6 | .\" This code is derived from software contributed to The NetBSD Foundation |
7 | .\" by Jukka Ruohonen. | | 7 | .\" by Jukka Ruohonen. |
8 | .\" | | 8 | .\" |
9 | .\" Redistribution and use in source and binary forms, with or without | | 9 | .\" Redistribution and use in source and binary forms, with or without |
10 | .\" modification, are permitted provided that the following conditions | | 10 | .\" modification, are permitted provided that the following conditions |
11 | .\" are met: | | 11 | .\" are met: |
12 | .\" 1. Redistributions of source code must retain the above copyright | | 12 | .\" 1. Redistributions of source code must retain the above copyright |
13 | .\" notice, this list of conditions and the following disclaimer. | | 13 | .\" notice, this list of conditions and the following disclaimer. |
14 | .\" 2. Redistributions in binary form must reproduce the above copyright | | 14 | .\" 2. Redistributions in binary form must reproduce the above copyright |
| @@ -17,27 +17,27 @@ | | | @@ -17,27 +17,27 @@ |
17 | .\" | | 17 | .\" |
18 | .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | | 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 | | 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 | | 20 | .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
21 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 21 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
22 | .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 22 | .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
23 | .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 23 | .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
24 | .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 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 | | 25 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
26 | .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 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 | | 27 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
28 | .\" POSSIBILITY OF SUCH DAMAGE. | | 28 | .\" POSSIBILITY OF SUCH DAMAGE. |
29 | .\" | | 29 | .\" |
30 | .Dd June 8, 2010 | | 30 | .Dd April 12, 2011 |
31 | .Dt TIMEVAL 3 | | 31 | .Dt TIMEVAL 3 |
32 | .Os | | 32 | .Os |
33 | .Sh NAME | | 33 | .Sh NAME |
34 | .Nm timeval , | | 34 | .Nm timeval , |
35 | .Nm timespec , | | 35 | .Nm timespec , |
36 | .Nm itimerval , | | 36 | .Nm itimerval , |
37 | .Nm itimerspec , | | 37 | .Nm itimerspec , |
38 | .Nm bintime | | 38 | .Nm bintime |
39 | .Nd time structures | | 39 | .Nd time structures |
40 | .Sh SYNOPSIS | | 40 | .Sh SYNOPSIS |
41 | .In sys/time.h | | 41 | .In sys/time.h |
42 | .Ft void | | 42 | .Ft void |
43 | .Fn TIMEVAL_TO_TIMESPEC "struct timeval *tv" "struct timespec *ts" | | 43 | .Fn TIMEVAL_TO_TIMESPEC "struct timeval *tv" "struct timespec *ts" |
| @@ -175,14 +175,15 @@ example(struct timespec *spec, time_t mi | | | @@ -175,14 +175,15 @@ example(struct timespec *spec, time_t mi |
175 | | | 175 | |
176 | _DIAGASSERT(spec != NULL); | | 176 | _DIAGASSERT(spec != NULL); |
177 | TIMEVAL_TO_TIMESPEC(&elapsed, spec); | | 177 | TIMEVAL_TO_TIMESPEC(&elapsed, spec); |
178 | | | 178 | |
179 | /* Add the offset for timeout in minutes. */ | | 179 | /* Add the offset for timeout in minutes. */ |
180 | spec->tv_sec = spec->tv_sec + minutes * 60; | | 180 | spec->tv_sec = spec->tv_sec + minutes * 60; |
181 | } | | 181 | } |
182 | .Ed | | 182 | .Ed |
183 | .Pp | | 183 | .Pp |
184 | A better alternative would use the more precise | | 184 | A better alternative would use the more precise |
185 | .Xr clock_gettime 2 . | | 185 | .Xr clock_gettime 2 . |
186 | .Sh SEE ALSO | | 186 | .Sh SEE ALSO |
187 | .Xr timeradd 3 , | | 187 | .Xr timeradd 3 , |
| | | 188 | .Xr tm 3 , |
188 | .Xr bintime_add 9 | | 189 | .Xr bintime_add 9 |