'\" te .\" Copyright 1994-2008 The FreeBSD Project. All Rights Reserved. .\" 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. .\" Portions Copyright (c) 2008, Sun Microsystems Inc. All Rights Reserved. .TH TIMERADD 3C "Jun 12, 2008" .SH NAME timeradd, timersub, timerclear, timerisset, timercmp \- operations on timeval structures .SH SYNOPSIS .LP .nf #include \fBvoid\fR \fBtimeradd\fR(\fBstruct timeval *\fR\fIa\fR, \fBstruct timeval *\fR\fIb\fR, \fBstruct timeval *\fR\fIres\fR); .fi .LP .nf \fBvoid\fR \fBtimerclear\fR(\fBstruct timeval *\fR\fItvp\fR); .fi .LP .nf \fBint\fR \fBtimercmp\fR(\fBstruct timeval *\fR\fIa\fR, \fBstruct timeval *\fR\fIb\fR, \fICMP\fR); .fi .LP .nf \fBint\fR \fBtimerisset\fR(\fBstruct timeval *\fR\fItvp\fR); .fi .LP .nf \fBvoid\fR \fBtimersub\fR(\fBstruct timeval *\fR\fIa\fR, \fBstruct timeval *\fR\fIb\fR, \fBstruct timeval *\fR\fIres\fR); .fi .SH DESCRIPTION .sp .LP These macros are provided for manipulating \fBtimeval\fR structures for use with \fBgettimeofday\fR(3C) and \fBsettimeofday\fR(3C) operands. The structure is defined in \fB\fR as: .sp .in +2 .nf struct timeval { long tv_sec; /* seconds since Jan. 1, 1970 */ long tv_usec; /* and microseconds */ }; .fi .in -2 .sp .LP The \fBtimeradd()\fR macro adds the time information stored in \fIa\fR to \fIb\fR and stores the resulting \fBtimeval\fR in \fIres\fR. The results are simplified such that the value of \fIres\fR\(->\fItv_usec\fR is always less than 1,000,000 (1 second). .sp .LP The \fBtimersub()\fR macro subtracts the time information stored in \fIb\fR from \fIa\fR and stores the resulting \fBtimeval\fR in \fIres\fR. .sp .LP The \fBtimerclear()\fR macro initializes \fItvp\fR to midnight (0 hour) January 1st, 1970 (the Epoch). .sp .LP The \fBtimerisset()\fR macro returns true if \fItvp\fR is set to any time value other than the Epoch. .sp .LP The \fBtimercmp()\fR macro compares \fIa\fR to \fIb\fR using the form a \fICMP\fR \fIb\fR, where \fICMP\fR is one of \fB<,\fR \fB<=\fR, \fB==\fR, \fB!=\fR, \fB>=\fR, or \fB>\fR. .SH USAGE .sp .LP These macros are not available in function form. All of these macros evaluate their arguments more than once. If parameters passed to these macros are expressions with side effects, the results are undefined. .SH ATTRIBUTES .sp .LP See \fBattributes\fR(7) for descriptions of the following attributes: .sp .sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ Interface Stability Committed _ MT-Level MT-Safe with Exceptions .TE .SH SEE ALSO .sp .LP .BR gettimeofday (3C), .BR attributes (7)