2 .\" Copyright 1994-2008 The FreeBSD Project. All Rights Reserved.
3 .\" Copyright (c) 1982, 1986, 1993 Regents of the University of California. All rights reserved. The Berkeley software License Agreement specifies the terms and conditions for redistribution.
4 .\" Portions Copyright (c) 2008, Sun Microsystems Inc. All Rights Reserved.
5 .TH TIMERADD 3C "Jun 12, 2008"
7 timeradd, timersub, timerclear, timerisset, timercmp \- operations on timeval
14 \fBvoid\fR \fBtimeradd\fR(\fBstruct timeval *\fR\fIa\fR, \fBstruct timeval *\fR\fIb\fR,
15 \fBstruct timeval *\fR\fIres\fR);
20 \fBvoid\fR \fBtimerclear\fR(\fBstruct timeval *\fR\fItvp\fR);
25 \fBint\fR \fBtimercmp\fR(\fBstruct timeval *\fR\fIa\fR, \fBstruct timeval *\fR\fIb\fR, \fICMP\fR);
30 \fBint\fR \fBtimerisset\fR(\fBstruct timeval *\fR\fItvp\fR);
35 \fBvoid\fR \fBtimersub\fR(\fBstruct timeval *\fR\fIa\fR, \fBstruct timeval *\fR\fIb\fR,
36 \fBstruct timeval *\fR\fIres\fR);
42 These macros are provided for manipulating \fBtimeval\fR structures for use
43 with \fBgettimeofday\fR(3C) and \fBsettimeofday\fR(3C) operands. The structure
44 is defined in \fB<sys/time.h>\fR as:
49 long tv_sec; /* seconds since Jan. 1, 1970 */
50 long tv_usec; /* and microseconds */
57 The \fBtimeradd()\fR macro adds the time information stored in \fIa\fR to
58 \fIb\fR and stores the resulting \fBtimeval\fR in \fIres\fR. The results are
59 simplified such that the value of \fIres\fR\(->\fItv_usec\fR is always less
60 than 1,000,000 (1 second).
63 The \fBtimersub()\fR macro subtracts the time information stored in \fIb\fR
64 from \fIa\fR and stores the resulting \fBtimeval\fR in \fIres\fR.
67 The \fBtimerclear()\fR macro initializes \fItvp\fR to midnight (0 hour) January
68 1st, 1970 (the Epoch).
71 The \fBtimerisset()\fR macro returns true if \fItvp\fR is set to any time value
75 The \fBtimercmp()\fR macro compares \fIa\fR to \fIb\fR using the form a
76 \fICMP\fR \fIb\fR, where \fICMP\fR is one of \fB<,\fR \fB<=\fR, \fB==\fR,
77 \fB!=\fR, \fB>=\fR, or \fB>\fR.
81 These macros are not available in function form. All of these macros evaluate
82 their arguments more than once. If parameters passed to these macros are
83 expressions with side effects, the results are undefined.
87 See \fBattributes\fR(5) for descriptions of the following attributes:
95 ATTRIBUTE TYPE ATTRIBUTE VALUE
97 Interface Stability Committed
99 MT-Level MT-Safe with Exceptions
105 \fBgettimeofday\fR(3C), \fBattributes\fR(5)