1TIMERADD(3bsd)                       LOCAL                      TIMERADD(3bsd)
2

NAME

4     timeradd, timersub, timerclear, timerisset, timercmp, timespecadd,
5     timespecsub, timespecclear, timespecisset, timespeccmp — operations on
6     time structure
7

LIBRARY

9     Utility functions from BSD systems (libbsd, -lbsd)
10

SYNOPSIS

12     #include <sys/time.h>
13     (See libbsd(7) for include usage.)
14
15     void
16     timeradd(struct timeval *a, struct timeval *b, struct timeval *res);
17
18     void
19     timersub(struct timeval *a, struct timeval *b, struct timeval *res);
20
21     void
22     timerclear(struct timeval *tv);
23
24     int
25     timerisset(struct timeval *tv);
26
27     int
28     timercmp(struct timeval *a, struct timeval *b, CMP);
29
30     void
31     timespecadd(struct timespec *a, struct timespec *b,
32         struct timespec *res);
33
34     void
35     timespecsub(struct timespec *a, struct timespec *b,
36         struct timespec *res);
37
38     void
39     timespecclear(struct timespec *ts);
40
41     int
42     timespecisset(struct timespec *ts);
43
44     int
45     timespeccmp(struct timespec *a, struct timespec b, CMP);
46

DESCRIPTION

48     These macros are provided for manipulating the timeval and timespec
49     structures described in timeval(3bsd).
50
51     The timeradd() and timespecadd() macros add the time information stored
52     in a to b, storing the result in res.  With timeradd() the results are
53     simplified such that the value of res->tv_usec is always less than
54     1,000,000 (1 second).  With timespecadd() the res->tv_nsec member of
55     struct timespec is always less than 1,000,000,000.
56
57     The timersub() and timespecsub() macros subtract the time information
58     stored in b from a and store the resulting structure in res.
59
60     The timerclear() and timespecclear() macros initialize the structures to
61     midnight (0 hour) January 1st, 1970 (the Epoch).  In other words, they
62     set the members of the structure to zero.
63
64     The timerisset() and timespecisset() macros return true if the input
65     structure is set to any time value other than the Epoch.
66
67     The timercmp() and timespeccmp() macros compare a to b using the compari‐
68     son operator given in CMP.  The result of the comparison is returned.
69

SEE ALSO

71     timeval(3bsd)
72

HISTORY

74     The timeradd() family of macros first appeared in NetBSD 1.1.  These were
75     later ported to FreeBSD 2.2.6.  The timespec() family of macros first
76     appeared in NetBSD 1.2.
77
78BSD                              June 7, 2010                              BSD
Impressum