Source-Changes-HG archive

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

[src/trunk]: src Add a manual page that describes the basic structures in <sy...



details:   https://anonhg.NetBSD.org/src/rev/3dacad8b40f4
branches:  trunk
changeset: 754937:3dacad8b40f4
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Mon May 17 07:10:15 2010 +0000

description:
Add a manual page that describes the basic structures in <sys/time.h>.

diffstat:

 distrib/sets/lists/comp/mi |   20 ++++++-
 share/man/man3/Makefile    |    9 ++-
 share/man/man3/timeval.3   |  138 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 164 insertions(+), 3 deletions(-)

diffs (261 lines):

diff -r 5f56fc545b98 -r 3dacad8b40f4 distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi        Mon May 17 05:20:05 2010 +0000
+++ b/distrib/sets/lists/comp/mi        Mon May 17 07:10:15 2010 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: mi,v 1.1447 2010/05/16 15:33:29 jruoho Exp $
+#      $NetBSD: mi,v 1.1448 2010/05/17 07:10:15 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4760,6 +4760,8 @@
 ./usr/share/man/cat3/TAILQ_NEXT.0              comp-c-catman           .cat
 ./usr/share/man/cat3/TAILQ_PREV.0              comp-c-catman           .cat
 ./usr/share/man/cat3/TAILQ_REMOVE.0            comp-c-catman           .cat
+./usr/share/man/cat3/TIMESPEC_TO_TIMEVAL.0             comp-c-catman           .cat
+./usr/share/man/cat3/TIMEVAL_TO_TIMESPEC.0             comp-c-catman           .cat
 ./usr/share/man/cat3/X509_NAME_ENTRY_get_object.0      comp-c-catman           crypto,.cat
 ./usr/share/man/cat3/X509_NAME_add_entry_by_txt.0      comp-c-catman           crypto,.cat
 ./usr/share/man/cat3/X509_NAME_get_index_by_NID.0      comp-c-catman           crypto,.cat
@@ -6278,6 +6280,8 @@
 ./usr/share/man/cat3/iswupper.0                        comp-c-catman           .cat
 ./usr/share/man/cat3/iswxdigit.0               comp-c-catman           .cat
 ./usr/share/man/cat3/isxdigit.0                        comp-c-catman           .cat
+./usr/share/man/cat3/itimerspec.0              comp-c-catman           .cat
+./usr/share/man/cat3/itimerval.0               comp-c-catman           .cat
 ./usr/share/man/cat3/j0.0                      comp-c-catman           .cat
 ./usr/share/man/cat3/j0f.0                     comp-c-catman           .cat
 ./usr/share/man/cat3/j1.0                      comp-c-catman           .cat
@@ -8221,6 +8225,8 @@
 ./usr/share/man/cat3/timerisset.0              comp-c-catman           .cat
 ./usr/share/man/cat3/timersub.0                        comp-c-catman           .cat
 ./usr/share/man/cat3/times.0                   comp-c-catman           .cat
+./usr/share/man/cat3/timespec.0                        comp-c-catman           .cat
+./usr/share/man/cat3/timeval.0                 comp-c-catman           .cat
 ./usr/share/man/cat3/timezone.0                        comp-c-catman           .cat
 ./usr/share/man/cat3/tmpfile.0                 comp-c-catman           .cat
 ./usr/share/man/cat3/tmpnam.0                  comp-c-catman           .cat
@@ -10654,6 +10660,8 @@
 ./usr/share/man/html3/TAILQ_NEXT.html          comp-c-htmlman          html
 ./usr/share/man/html3/TAILQ_PREV.html          comp-c-htmlman          html
 ./usr/share/man/html3/TAILQ_REMOVE.html                comp-c-htmlman          html
+./usr/share/man/html3/TIMESPEC_TO_TIMEVAL.html comp-c-htmlman          html
+./usr/share/man/html3/TIMEVAL_TO_TIMESPEC.html comp-c-htmlman          html
 ./usr/share/man/html3/X509_NAME_ENTRY_get_object.html  comp-c-htmlman          crypto,html
 ./usr/share/man/html3/X509_NAME_add_entry_by_txt.html  comp-c-htmlman          crypto,html
 ./usr/share/man/html3/X509_NAME_get_index_by_NID.html  comp-c-htmlman          crypto,html
@@ -12113,6 +12121,8 @@
 ./usr/share/man/html3/iswupper.html            comp-c-htmlman          html
 ./usr/share/man/html3/iswxdigit.html           comp-c-htmlman          html
 ./usr/share/man/html3/isxdigit.html            comp-c-htmlman          html
+./usr/share/man/html3/itimerspec.html          comp-c-htmlman          html
+./usr/share/man/html3/itimerval.html           comp-c-htmlman          html
 ./usr/share/man/html3/j0.html                  comp-c-htmlman          html
 ./usr/share/man/html3/j0f.html                 comp-c-htmlman          html
 ./usr/share/man/html3/j1.html                  comp-c-htmlman          html
@@ -13978,6 +13988,8 @@
 ./usr/share/man/html3/timerisset.html          comp-c-htmlman          html
 ./usr/share/man/html3/timersub.html            comp-c-htmlman          html
 ./usr/share/man/html3/times.html               comp-c-htmlman          html
+./usr/share/man/html3/timespec.html            comp-c-htmlman          html
+./usr/share/man/html3/timeval.html             comp-c-htmlman          html
 ./usr/share/man/html3/timezone.html            comp-c-htmlman          html
 ./usr/share/man/html3/tmpfile.html             comp-c-htmlman          html
 ./usr/share/man/html3/tmpnam.html              comp-c-htmlman          html
@@ -16348,6 +16360,8 @@
 ./usr/share/man/man3/TAILQ_NEXT.3              comp-c-man              .man
 ./usr/share/man/man3/TAILQ_PREV.3              comp-c-man              .man
 ./usr/share/man/man3/TAILQ_REMOVE.3            comp-c-man              .man
+./usr/share/man/man3/TIMESPEC_TO_TIMEVAL.3     comp-c-man              .man
+./usr/share/man/man3/TIMEVAL_TO_TIMESPEC.3     comp-c-man              .man
 ./usr/share/man/man3/X509_NAME_ENTRY_get_object.3      comp-c-man              crypto,.man
 ./usr/share/man/man3/X509_NAME_add_entry_by_txt.3      comp-c-man              crypto,.man
 ./usr/share/man/man3/X509_NAME_get_index_by_NID.3      comp-c-man              crypto,.man
@@ -17866,6 +17880,8 @@
 ./usr/share/man/man3/iswupper.3                        comp-c-man              .man
 ./usr/share/man/man3/iswxdigit.3               comp-c-man              .man
 ./usr/share/man/man3/isxdigit.3                        comp-c-man              .man
+./usr/share/man/man3/itimerspec.3              comp-c-man              .man
+./usr/share/man/man3/itimerval.3               comp-c-man              .man
 ./usr/share/man/man3/j0.3                      comp-c-man              .man
 ./usr/share/man/man3/j0f.3                     comp-c-man              .man
 ./usr/share/man/man3/j1.3                      comp-c-man              .man
@@ -19805,6 +19821,8 @@
 ./usr/share/man/man3/timerisset.3              comp-c-man              .man
 ./usr/share/man/man3/timersub.3                        comp-c-man              .man
 ./usr/share/man/man3/times.3                   comp-c-man              .man
+./usr/share/man/man3/timespec.3                        comp-c-man              .man
+./usr/share/man/man3/timeval.3                 comp-c-man              .man
 ./usr/share/man/man3/timezone.3                        comp-c-man              .man
 ./usr/share/man/man3/tmpfile.3                 comp-c-man              .man
 ./usr/share/man/man3/tmpnam.3                  comp-c-man              .man
diff -r 5f56fc545b98 -r 3dacad8b40f4 share/man/man3/Makefile
--- a/share/man/man3/Makefile   Mon May 17 05:20:05 2010 +0000
+++ b/share/man/man3/Makefile   Mon May 17 07:10:15 2010 +0000
@@ -1,11 +1,11 @@
-#      $NetBSD: Makefile,v 1.51 2010/05/16 15:33:30 jruoho Exp $
+#      $NetBSD: Makefile,v 1.52 2010/05/17 07:10:16 jruoho Exp $
 #      @(#)Makefile    8.2 (Berkeley) 12/13/93
 
 MAN=   _DIAGASSERT.3 __CONCAT.3 __UNCONST.3 CMSG_DATA.3 \
        __arraycount.3 assert.3 bits.3 bitstring.3 dirent.3 dlfcn.3 end.3 \
        fast_divide32.3 ffs32.3 gcq.3 intro.3 inttypes.3 iso646.3 offsetof.3 \
        queue.3 rb.3 stdarg.3 stdbool.3 stddef.3 stdint.3 stdlib.3 sysexits.3 \
-       tgmath.3 timeradd.3 tree.3 types.3 varargs.3
+       tgmath.3 timeradd.3 timeval.3 tree.3 types.3 varargs.3
 
 USETBL=        # used by queue.3
 
@@ -209,6 +209,11 @@
        timeradd.3 timerclear.3 \
        timeradd.3 timerisset.3 \
        timeradd.3 timercmp.3
+MLINKS+=timeval.3 timespec.3 \
+       timeval.3 itimerval.3 \
+       timeval.3 itimerspec.3 \
+       timeval.3 TIMEVAL_TO_TIMESPEC.3 \
+       timeval.3 TIMESPEC_TO_TIMEVAL.3
 MLINKS+=tree.3 SPLAY_PROTOTYPE.3 tree.3 SPLAY_GENERATE.3 \
        tree.3 SPLAY_ENTRY.3 tree.3 SPLAY_HEAD.3 \
        tree.3 SPLAY_INITIALIZER.3 tree.3 SPLAY_ROOT.3 \
diff -r 5f56fc545b98 -r 3dacad8b40f4 share/man/man3/timeval.3
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man3/timeval.3  Mon May 17 07:10:15 2010 +0000
@@ -0,0 +1,138 @@
+.\" $NetBSD: timeval.3,v 1.1 2010/05/17 07:10:16 jruoho Exp $
+.\"
+.\" 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 May 17, 2010
+.Dt TIMESPEC 3
+.Os
+.Sh NAME
+.Nm timeval ,
+.Nm timespec ,
+.Nm itimerval ,
+.Nm itimerspec ,
+.Nd time structures
+.Sh SYNOPSIS
+.In sys/time.h
+.Ft void
+.Fn TIMEVAL_TO_TIMESPEC "struct timeval *tv" "struct timespec *ts"
+.Ft void
+.Fn TIMESPEC_TO_TIMEVAL "struct timeval *tv" "struct timespec *ts"
+.Sh DESCRIPTION
+The
+.In sys/time.h
+header, included by
+.In time.h ,
+defines various structures related to time and timers.
+.Bl -enum -offset 1n
+.It
+The following structure is used by
+.Xr gettimeofday 2 ,
+among others:
+.Bd -literal -offset indent
+struct timeval {
+       time_t          tv_sec;
+       suseconds_t     tv_usec;
+};
+.Ed
+.Pp
+The
+.Va tv_sec
+member represents the elapsed time, in whole seconds.
+The
+.Va tv_usec
+member captures rest of the elapsed times,
+represented as the number of microseconds.
+.It
+The following structure is used by
+.Xr nanosleep 2 ,
+among others:
+.Bd -literal -offset indent
+struct timespec {
+       time_t          tv_sec;
+       long            tv_nsec;
+};
+.Ed
+.Pp
+The
+.Va tv_sec
+member is again the number of elapsed time in whole seconds.
+The
+.Va tv_nsec
+member represents the rest of the elapsed time in nanoseconds.
+.Pp
+A microsecond is equal to one millionth of a second,
+1000 nanoseconds, or 1/1000 milliseconds.
+To ease the conversions, the macros
+.Fn TIMEVAL_TO_TIMESPEC
+and
+.Fn TIMESPEC_TO_TIMEVAL
+can be used to convert between
+.Em struct timeval
+and
+.Em struct timespec .
+.It
+The following structure is used by
+.Xr setitimer 2 ,
+among others:
+.Bd -literal -offset indent
+struct itimerval {
+       struct timeval  it_interval;
+       struct timeval  it_value;
+};
+.Ed
+.It
+The following structure is used by
+.Xr timer_settime 2 ,
+among others:
+.Bd -literal -offset indent
+struct itimerspec {
+       struct timespec it_interval;
+       struct timespec it_value;
+};
+.Ed
+.Pp
+Both
+.Em struct itimerval
+and
+.Em struct itimerspec
+are used to specify when a timer expires.
+Generally,
+.Va it_interval
+specifies the period between successive timer expirations.
+A value zero implies that the alarm will fire only once.
+If
+.Va it_value
+is non-zero, it indicates the time left to the next timer expiration.
+A value zero implies that the timer is disabled.
+.El
+.Pp
+.Sh STANDARDS
+These structures conform to
+.St -p1003.1-2004 .
+.Sh SEE ALSO
+.Xr timeradd 3



Home | Main Index | Thread Index | Old Index