mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-22 02:12:10 +03:00
add timer cmp,isset and clear to fallback macros and improve file documentation
This commit is contained in:
parent
5c9c1a7025
commit
3232c85269
@ -18,14 +18,26 @@
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief BSD style time functions
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _NETSURF_UTILS_SYS_TIME_H_
|
||||
#define _NETSURF_UTILS_SYS_TIME_H_
|
||||
#ifndef NETSURF_UTILS_SYS_TIME_H_
|
||||
#define NETSURF_UTILS_SYS_TIME_H_
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifndef timerclear
|
||||
#define timerclear(a) (a)->tv_sec = (a)->tv_usec = 0
|
||||
#endif
|
||||
|
||||
#ifndef timerisset
|
||||
#define timerisset(a) ((a)->tv_sec || (a)->tv_usec)
|
||||
#endif
|
||||
|
||||
#ifndef timeradd
|
||||
#define timeradd(a, aa, result) \
|
||||
do { \
|
||||
@ -50,4 +62,10 @@
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifndef timercmp
|
||||
#define timercmp(a, aa, cmp) \
|
||||
((a)->tv_sec cmp (aa)->tv_sec || \
|
||||
(a)->tv_sec == (aa)->tv_sec && (a)->tv_usec cmp (aa)->tv_usec)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user