Template Version: @(#)sac_nextcase 1.66 04/17/08 SMI
This information is Copyright 2008 Sun Microsystems
1. Introduction
1.1. Project/Component Working Name:
Add timeradd() and timersub() to <sys/time.h>.
1.2. Name of Document Author/Supplier:
Author: Dan McDonald
1.3 Date of This Document:
09 June, 2008
4. Technical Description
We propose the addition of two macros in sys/time.h commonly found in
BSD and Linux systems -- timeradd() and timersub() -- and the
documentation of both these AND the existing timerisset(),
timerclear(), and timercmp() functions.
The proposed interface taxonomy is "Committed", and the proposed
release binding is Micro/Patch.
A draft man page for these functions is in the case's materials
directory and is included here:
Standard C Library Functions timeradd(3C)
NAME
timeradd, timersub, timerclear, timerisset, timercmp -- operations on
timeval structures
SYNOPSIS
#include <sys/time.h>
void
timeradd(struct timeval *a, struct timeval *b, struct timeval *res);
void
timerclear(struct timeval *tvp);
int
timercmp(struct timeval *a, struct timeval *b, CMP);
int
timerisset(struct timeval *tvp);
void
timersub(struct timeval *a, struct timeval *b, struct timeval *res);
DESCRIPTION
These macros are provided for manipulating timeval structures for use
with gettimeofday() and settimeofday() operands. The structure is
defined in <sys/time.h> as:
struct timeval {
long tv_sec; /* seconds since Jan. 1, 1970 */
long tv_usec; /* and microseconds */
};
timeradd() adds the time information stored in a to b and stores the
resulting timeval in res. The results are simplified such that the value
of res->tv_usec is always less than 1,000,000 (1 second).
timersub() subtracts the time information stored in b from a and stores
the resulting timeval in res.
timerclear() initializes tvp to midnight (0 hour) January 1st, 1970 (the
Epoch).
timerisset() returns true if tvp is set to any time value other than the
Epoch.
timercmp() compares a to b using the form a CMP b, where CMP is one of
<, <=, ==, !=, >=, or >.
SEE ALSO
gettimeofday(3C)
USAGE
These macros are not available in function form. All of these macros
evaulate their arguments more than once. If parameters passed to these
macros are expressions with side effects, the results are undefined.
lint will complain about a constant conditional for timeradd() and
timersub(). Use of the /* LINTED */ comment before timeradd() or
timersub() is recommended.
ATTRIBUTES
____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| Interface Stability | These macros are Committed. |
|_____________________________|_____________________________|
| MT-Level | MT-Safe with Exceptions |
| | (See USAGE about arguments) |
|_____________________________|_____________________________|
6. Resources and Schedule
6.4. Steering Committee requested information
6.4.1. Consolidation C-team Name:
ON
6.5. ARC review type: FastTrack
6.6. ARC Exposure: open