1TIMERADD(3)                Linux Programmer's Manual               TIMERADD(3)
2
3
4

NAME

6       timeradd,  timersub,  timercmp, timerclear, timerisset - timeval opera‐
7       tions
8

SYNOPSIS

10       #include <sys/time.h>
11
12       void timeradd(struct timeval *a, struct timeval *b,
13                     struct timeval *res);
14
15       void timersub(struct timeval *a, struct timeval *b,
16                     struct timeval *res);
17
18       void timerclear(struct timeval *tvp);
19
20       int timerisset(struct timeval *tvp);
21
22       int timercmp(struct timeval *a, struct timeval *b, CMP);
23
24   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
25
26       All functions shown above: _BSD_SOURCE
27

DESCRIPTION

29       The macros are provided to operate on timeval  structures,  defined  in
30       <sys/time.h> as:
31
32           struct timeval {
33               time_t      tv_sec;     /* seconds */
34               suseconds_t tv_usec;    /* microseconds */
35           };
36
37       timeradd()  adds  the time values in a and b, and places the sum in the
38       timeval pointed  to  by  res.   The  result  is  normalized  such  that
39       res->tv_usec has a value in the range 0 to 999,999.
40
41       timersub()  subtracts the time value in b from the time value in a, and
42       places the result in the timeval pointed to by res.  The result is nor‐
43       malized such that res->tv_usec has a value in the range 0 to 999,999.
44
45       timerclear() zeros out the timeval structure pointed to by tvp, so that
46       it represents the Epoch: 1970-01-01 00:00:00 +0000 (UTC).
47
48       timerisset() returns true (nonzero) if  either  field  of  the  timeval
49       structure pointed to by tvp contains a nonzero value.
50
51       timercmp()  compares  the  timer values in a and b using the comparison
52       operator CMP, and returns true (nonzero) or false (0) depending on  the
53       result  of  the comparison.  Some systems (but not Linux/glibc), have a
54       broken timercmp() implementation, in which CMP of >=, <=, and == do not
55       work; portable applications can instead use
56
57           !timercmp(..., <)
58           !timercmp(..., >)
59           !timercmp(..., !=)
60

RETURN VALUE

62       timerisset() and timercmp() return true (nonzero) or false (0).
63

ERRORS

65       No errors are defined.
66

CONFORMING TO

68       Not in POSIX.1-2001.  Present on most BSD derivatives.
69

SEE ALSO

71       gettimeofday(2), time(7)
72

COLOPHON

74       This  page  is  part of release 3.53 of the Linux man-pages project.  A
75       description of the project, and information about reporting  bugs,  can
76       be found at http://www.kernel.org/doc/man-pages/.
77
78
79
80Linux                             2010-02-25                       TIMERADD(3)
Impressum