1 .\" Copyright (c) 2007 by Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" 2007-07-31, mtk, Created
27 .TH TIMERADD 3 2010-02-25 "Linux" "Linux Programmer's Manual"
29 timeradd, timersub, timercmp, timerclear, timerisset \- timeval operations
32 .B #include <sys/time.h>
34 .BI "void timeradd(struct timeval *" a ", struct timeval *" b ,
35 .BI " struct timeval *" res );
37 .BI "void timersub(struct timeval *" a ", struct timeval *" b ,
38 .BI " struct timeval *" res );
40 .BI "void timerclear(struct timeval *" tvp );
42 .BI "int timerisset(struct timeval *" tvp );
44 .BI "int timercmp(struct timeval *" a ", struct timeval *" b ", " CMP );
48 Feature Test Macro Requirements for glibc (see
49 .BR feature_test_macros (7)):
52 All functions shown above:
55 The macros are provided to operate on
57 structures, defined in
64 time_t tv_sec; /* seconds */
65 suseconds_t tv_usec; /* microseconds */
71 adds the time values in
75 and places the sum in the
79 The result is normalized such that
81 has a value in the range 0 to 999,999.
84 subtracts the time value in
86 from the time value in
88 and places the result in the
92 The result is normalized such that
94 has a value in the range 0 to 999,999.
99 structure pointed to by
101 so that it represents the Epoch: 1970-01-01 00:00:00 +0000 (UTC).
104 returns true (nonzero) if either field of the
106 structure pointed to by
108 contains a nonzero value.
111 compares the timer values in
115 using the comparison operator
117 and returns true (nonzero) or false (0) depending on
118 the result of the comparison.
119 Some systems (but not Linux/glibc),
123 .\" HP-UX, Tru64, Irix have a definition like:
124 .\"#define timercmp(tvp, uvp, cmp) \
125 .\" ((tvp)->tv_sec cmp (uvp)->tv_sec || \
126 .\" (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
135 portable applications can instead use
144 return true (nonzero) or false (0).
146 No errors are defined.
149 Present on most BSD derivatives.
151 .BR gettimeofday (2),