1 .\" Copyright (c) 2007 by Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\" 2007-07-31, mtk, Created
7 .TH TIMERADD 3 2021-03-22 "Linux man-pages (unreleased)" "Linux Programmer's Manual"
9 timeradd, timersub, timercmp, timerclear, timerisset \- timeval operations
12 .RI ( libc ", " \-lc )
15 .B #include <sys/time.h>
17 .BI "void timeradd(struct timeval *" a ", struct timeval *" b ,
18 .BI " struct timeval *" res );
19 .BI "void timersub(struct timeval *" a ", struct timeval *" b ,
20 .BI " struct timeval *" res );
22 .BI "void timerclear(struct timeval *" tvp );
23 .BI "int timerisset(struct timeval *" tvp );
25 .BI "int timercmp(struct timeval *" a ", struct timeval *" b ", " CMP );
29 Feature Test Macro Requirements for glibc (see
30 .BR feature_test_macros (7)):
33 All functions shown above:
37 Glibc 2.19 and earlier:
41 The macros are provided to operate on
43 structures, defined in
50 time_t tv_sec; /* seconds */
51 suseconds_t tv_usec; /* microseconds */
57 adds the time values in
61 and places the sum in the
65 The result is normalized such that
67 has a value in the range 0 to 999,999.
70 subtracts the time value in
72 from the time value in
74 and places the result in the
78 The result is normalized such that
80 has a value in the range 0 to 999,999.
85 structure pointed to by
87 so that it represents the Epoch: 1970-01-01 00:00:00 +0000 (UTC).
90 returns true (nonzero) if either field of the
92 structure pointed to by
94 contains a nonzero value.
97 compares the timer values in
101 using the comparison operator
103 and returns true (nonzero) or false (0) depending on
104 the result of the comparison.
105 Some systems (but not Linux/glibc),
109 .\" HP-UX, Tru64, Irix have a definition like:
110 .\"#define timercmp(tvp, uvp, cmp) \
111 .\" ((tvp)->tv_sec cmp (uvp)->tv_sec || \
112 .\" (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec)
121 portable applications can instead use
134 return true (nonzero) or false (0).
136 No errors are defined.
139 Present on most BSD derivatives.
141 .BR gettimeofday (2),