1timeradd(3C)             Standard C Library Functions             timeradd(3C)
2
3
4

NAME

6       timeradd,  timersub,  timerclear,  timerisset, timercmp - operations on
7       timeval structures
8

SYNOPSIS

10       #include <sys/time.h>
11
12       void timeradd(struct timeval *a, struct timeval *b,
13            struct timeval *res);
14
15
16       void timerclear(struct timeval *tvp);
17
18
19       int timercmp(struct timeval *a, struct timeval *b, CMP);
20
21
22       int timerisset(struct timeval *tvp);
23
24
25       void timersub(struct timeval *a, struct timeval *b,
26            struct timeval *res);
27
28

DESCRIPTION

30       These macros are provided for manipulating timeval structures  for  use
31       with  gettimeofday(3C)  and settimeofday(3C) operands. The structure is
32       defined in <sys/time.h> as:
33
34         struct timeval {
35             long    tv_sec;     /* seconds since Jan. 1, 1970 */
36             long    tv_usec;    /* and microseconds */
37         };
38
39
40
41       The timeradd() macro adds the time information stored in  a  to  b  and
42       stores  the  resulting  timeval in res. The results are simplified such
43       that the value of restv_usec is always less than 1,000,000 (1 second).
44
45
46       The timersub() macro subtracts the time information stored in b from  a
47       and stores the resulting timeval in res.
48
49
50       The  timerclear()  macro  initializes  tvp to midnight (0 hour) January
51       1st, 1970 (the Epoch).
52
53
54       The timerisset() macro returns true if tvp is set  to  any  time  value
55       other than the Epoch.
56
57
58       The  timercmp() macro compares a to b using the form a CMP b, where CMP
59       is one of <, <=, ==, !=, >=, or >.
60

USAGE

62       These macros are not available in function form. All  of  these  macros
63       evaluate  their arguments more than once. If parameters passed to these
64       macros are expressions with side effects, the results are undefined.
65

ATTRIBUTES

67       See attributes(5) for descriptions of the following attributes:
68
69
70
71
72       ┌─────────────────────────────┬─────────────────────────────┐
73       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
74       ├─────────────────────────────┼─────────────────────────────┤
75       │Interface Stability          │Committed                    │
76       ├─────────────────────────────┼─────────────────────────────┤
77       │MT-Level                     │MT-Safe with Exceptions      │
78       └─────────────────────────────┴─────────────────────────────┘
79

SEE ALSO

81       gettimeofday(3C), attributes(5)
82
83
84
85SunOS 5.11                        12 Jun 2008                     timeradd(3C)
Impressum