NetSurf
Macros
sys_time.h File Reference

BSD style timeval macros. More...

#include <sys/time.h>
Include dependency graph for sys_time.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define timerclear(a)   ((a)->tv_sec = (a)->tv_usec = 0)
 
#define timerisset(a)   ((a)->tv_sec || (a)->tv_usec)
 
#define timeradd(a, aa, result)
 
#define timersub(a, aa, result)
 
#define timercmp(a, aa, cmp)
 

Detailed Description

BSD style timeval macros.

BSD added macros for manipulating timeval which have become standard on modern c libraries but for compatability where they are missing it is necessary to provide fallbacks.

Definition in file sys_time.h.

Macro Definition Documentation

◆ timeradd

#define timeradd (   a,
  aa,
  result 
)
Value:
do { \
(result)->tv_sec = (a)->tv_sec + (aa)->tv_sec; \
(result)->tv_usec = (a)->tv_usec + (aa)->tv_usec; \
if ((result)->tv_usec >= 1000000) { \
++(result)->tv_sec; \
(result)->tv_usec -= 1000000; \
} \
} while (0)
STATIC char result[100]
Definition: arexx.c:77

Definition at line 42 of file sys_time.h.

◆ timerclear

#define timerclear (   a)    ((a)->tv_sec = (a)->tv_usec = 0)

Definition at line 34 of file sys_time.h.

◆ timercmp

#define timercmp (   a,
  aa,
  cmp 
)
Value:
(((a)->tv_sec cmp (aa)->tv_sec) || \
((a)->tv_sec == (aa)->tv_sec && (a)->tv_usec cmp (aa)->tv_usec))

Definition at line 66 of file sys_time.h.

◆ timerisset

#define timerisset (   a)    ((a)->tv_sec || (a)->tv_usec)

Definition at line 38 of file sys_time.h.

◆ timersub

#define timersub (   a,
  aa,
  result 
)
Value:
do { \
(result)->tv_sec = (a)->tv_sec - (aa)->tv_sec; \
(result)->tv_usec = (a)->tv_usec - (aa)->tv_usec; \
if ((result)->tv_usec < 0) { \
--(result)->tv_sec; \
(result)->tv_usec += 1000000; \
} \
} while (0)

Definition at line 54 of file sys_time.h.