]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/timeradd.3
Fix redundant formatting macros
[thirdparty/man-pages.git] / man3 / timeradd.3
CommitLineData
c11b1abf 1.\" Copyright (c) 2007 by Michael Kerrisk <mtk.manpages@gmail.com>
d6d74fd8
MK
2.\"
3.\" Permission is granted to make and distribute verbatim copies of this
4.\" manual provided the copyright notice and this permission notice are
5.\" preserved on all copies.
6.\"
7.\" Permission is granted to copy and distribute modified versions of this
8.\" manual under the conditions for verbatim copying, provided that the
9.\" entire resulting derived work is distributed under the terms of a
10.\" permission notice identical to this one.
11.\"
12.\" Since the Linux kernel and libraries are constantly changing, this
13.\" manual page may be incorrect or out-of-date. The author(s) assume no
14.\" responsibility for errors or omissions, or for damages resulting from
15.\" the use of the information contained herein.
16.\"
17.\" Formatted or processed versions of this manual, if unaccompanied by
18.\" the source, must acknowledge the copyright and authors of this work.
19.\"
20.\" 2007-07-31, mtk, Created
21.\"
22.TH TIMERADD 3 2007-07-31 "Linux" "Linux Programmer's Manual"
23.SH NAME
93d67152 24timeradd, timersub, timercmp, timerclear, timerisset \- timeval operations
d6d74fd8
MK
25.SH SYNOPSIS
26.nf
27.B #include <sys/time.h>
28
29.BI "void timeradd(struct timeval *" a ", struct timeval *" b ,
30.BI " struct timeval *" res );
31
32.BI "void timersub(struct timeval *" a ", struct timeval *" b ,
33.BI " struct timeval *" res );
34
35.BI "void timerclear(struct timeval *" tvp );
36
37.BI "void timerisset(struct timeval *" tvp );
38
39.BI "void timercmp(struct timeval *" a ", struct timeval *" b ", " CMP );
40.fi
41.sp
42.in -4n
43Feature Test Macro Requirements for glibc (see
44.BR feature_test_macros (7)):
45.in
46.sp
93d67152 47All functions shown above require:
d6d74fd8
MK
48_BSD_SOURCE
49.SH DESCRIPTION
50The macros are provided to operate on
51.I timeval
52structures, defined in
0daa9e92 53.I <sys/time.h>
d6d74fd8
MK
54as:
55.sp
56.in +0.5i
57.nf
58struct timeval {
59 time_t tv_sec; /* seconds */
60 suseconds_t tv_usec; /* microseconds */
61};
62.fi
63.PP
64.BR timeradd ()
65adds the time values in
66.I a
67and
68.IR b ,
69and places the sum in the
70.I timeval
71pointed to by
72.IR res .
73The result is normalized such that
74.I res->tv_usec
75has a value in the range 0 to 999,999.
76
77.BR timersub ()
93d67152 78subtracts the time value in
d6d74fd8 79.I b
93d67152 80from the time value in
d6d74fd8
MK
81.IR a ,
82and places the result in the
83.I timeval
84pointed to by
85.IR res .
86The result is normalized such that
87.I res->tv_usec
88has a value in the range 0 to 999,999.
89
90.BR timerclear ()
91zeroes out the
92.I timeval
93structure pointed to by
94.IR tvp ,
95so that it represents the time at midnight
96on the morning of 1 January 1970 (the Epoch).
97
98.BR timerisset ()
99returns true (non-zero) if either field of the
100.I timeval
101structure pointed to by
0daa9e92 102.I tvp
d6d74fd8
MK
103contains a non-zero value.
104
105.BR timercmp ()
106compares the timer values in
107.I a
108and
0daa9e92 109.I b
d6d74fd8
MK
110using the comparison operator
111.IR CMP ,
112and returns true (non-zero) or false (0) depending on
113the result of the comparison.
114.SH RETURN VALUE
115.BR timerisset ()
116and
117.BR timercmp ()
118return true (non-zero) or false (0).
119.BR
120.SH ERRORS
121No errors are defined.
122.SH CONFORMING TO
123Not in POSIX.1-2001.
124Present on most BSD derivatives.
125.SH "SEE ALSO"
126.BR gettimeofday (2),
127.BR time (7).