Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/share/man/man3 Note clock_gettime(2) in the example.



details:   https://anonhg.NetBSD.org/src/rev/1a18a26369f3
branches:  trunk
changeset: 755022:1a18a26369f3
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Thu May 20 05:37:58 2010 +0000

description:
Note clock_gettime(2) in the example.

diffstat:

 share/man/man3/timeval.3 |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r 3f5641baf706 -r 1a18a26369f3 share/man/man3/timeval.3
--- a/share/man/man3/timeval.3  Thu May 20 05:19:29 2010 +0000
+++ b/share/man/man3/timeval.3  Thu May 20 05:37:58 2010 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: timeval.3,v 1.9 2010/05/19 13:41:39 tsutsui Exp $
+.\" $NetBSD: timeval.3,v 1.10 2010/05/20 05:37:58 jruoho Exp $
 .\"
 .\" Copyright (c) 2010 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 19, 2010
+.Dd May 20, 2010
 .Dt TIMEVAL 3
 .Os
 .Sh NAME
@@ -171,15 +171,17 @@
 {
        struct timeval elapsed;
 
-       _DIAGASSERT(spec != NULL);
-
        (void)gettimeofday(&elapsed, NULL);
 
+       _DIAGASSERT(spec != NULL);
        TIMEVAL_TO_TIMESPEC(&elapsed, spec);
 
        /* Add the offset for timeout in minutes. */
        spec->tv_sec = spec->tv_sec + minutes * 60;
 }
 .Ed
+.Pp
+A better alternative would use the more precise
+.Xr clock_gettime 2 .
 .Sh SEE ALSO
 .Xr timeradd 3



Home | Main Index | Thread Index | Old Index