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 time at midnight on the morning  of  1  January  1970
47       (the Epoch).
48
49       timerisset()  returns  true  (non-zero)  if either field of the timeval
50       structure pointed to by tvp contains a non-zero value.
51
52       timercmp() compares the timer values in a and b  using  the  comparison
53       operator CMP, and returns true (non-zero) or false (0) depending on the
54       result of the comparison.  Some systems (but not Linux/glibc),  have  a
55       broken timercmp() implementation, in which CMP of >=, <=, and == do not
56       work; portable applications can instead use
57
58           !timercmp(..., <)
59           !timercmp(..., >)
60           !timercmp(..., !=)
61

RETURN VALUE

63       timerisset() and timercmp() return true (non-zero) or false (0).
64

ERRORS

66       No errors are defined.
67

CONFORMING TO

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

SEE ALSO

72       gettimeofday(2), time(7)
73

COLOPHON

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