]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/timeradd.3
timeradd.3: SYNOPSIS: Fix return types of timerisset() and timercmp()
[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
10d76543
MK
15.\" the use of the information contained herein. The author(s) may not
16.\" have taken the same level of care in the production of this manual,
17.\" which is licensed free of charge, as they might when working
18.\" professionally.
d6d74fd8
MK
19.\"
20.\" Formatted or processed versions of this manual, if unaccompanied by
21.\" the source, must acknowledge the copyright and authors of this work.
22.\"
23.\" 2007-07-31, mtk, Created
24.\"
f6c92d2a 25.TH TIMERADD 3 2009-02-26 "Linux" "Linux Programmer's Manual"
d6d74fd8 26.SH NAME
93d67152 27timeradd, timersub, timercmp, timerclear, timerisset \- timeval operations
d6d74fd8
MK
28.SH SYNOPSIS
29.nf
30.B #include <sys/time.h>
31
32.BI "void timeradd(struct timeval *" a ", struct timeval *" b ,
33.BI " struct timeval *" res );
34
35.BI "void timersub(struct timeval *" a ", struct timeval *" b ,
36.BI " struct timeval *" res );
37
38.BI "void timerclear(struct timeval *" tvp );
39
f6c92d2a 40.BI "int timerisset(struct timeval *" tvp );
d6d74fd8 41
f6c92d2a 42.BI "int timercmp(struct timeval *" a ", struct timeval *" b ", " CMP );
d6d74fd8
MK
43.fi
44.sp
45.in -4n
46Feature Test Macro Requirements for glibc (see
47.BR feature_test_macros (7)):
48.in
49.sp
cfc2d88d 50All functions shown above:
d6d74fd8
MK
51_BSD_SOURCE
52.SH DESCRIPTION
53The macros are provided to operate on
54.I timeval
55structures, defined in
0daa9e92 56.I <sys/time.h>
d6d74fd8
MK
57as:
58.sp
088a639b 59.in +4n
d6d74fd8
MK
60.nf
61struct timeval {
62 time_t tv_sec; /* seconds */
63 suseconds_t tv_usec; /* microseconds */
64};
65.fi
088a639b 66.in
d6d74fd8
MK
67.PP
68.BR timeradd ()
69adds the time values in
70.I a
71and
72.IR b ,
73and places the sum in the
74.I timeval
75pointed to by
76.IR res .
77The result is normalized such that
94e9d9fe 78.I res\->tv_usec
d6d74fd8
MK
79has a value in the range 0 to 999,999.
80
81.BR timersub ()
93d67152 82subtracts the time value in
d6d74fd8 83.I b
93d67152 84from the time value in
d6d74fd8
MK
85.IR a ,
86and places the result in the
87.I timeval
88pointed to by
89.IR res .
90The result is normalized such that
94e9d9fe 91.I res\->tv_usec
d6d74fd8
MK
92has a value in the range 0 to 999,999.
93
94.BR timerclear ()
7b01461a 95zeros out the
d6d74fd8
MK
96.I timeval
97structure pointed to by
98.IR tvp ,
99so that it represents the time at midnight
100on the morning of 1 January 1970 (the Epoch).
101
102.BR timerisset ()
eba72288 103returns true (non-zero) if either field of the
d6d74fd8
MK
104.I timeval
105structure pointed to by
0daa9e92 106.I tvp
eba72288 107contains a non-zero value.
d6d74fd8
MK
108
109.BR timercmp ()
110compares the timer values in
111.I a
112and
0daa9e92 113.I b
d6d74fd8
MK
114using the comparison operator
115.IR CMP ,
eba72288 116and returns true (non-zero) or false (0) depending on
d6d74fd8
MK
117the result of the comparison.
118.SH RETURN VALUE
119.BR timerisset ()
120and
121.BR timercmp ()
eba72288 122return true (non-zero) or false (0).
d6d74fd8
MK
123.SH ERRORS
124No errors are defined.
125.SH CONFORMING TO
126Not in POSIX.1-2001.
127Present on most BSD derivatives.
128.SH "SEE ALSO"
129.BR gettimeofday (2),
f0c34053 130.BR time (7)