mirror of
git://git.musl-libc.org/musl
synced 2024-12-16 11:45:13 +00:00
add legacy BSD-style timer*() macros in sys/time.h
This commit is contained in:
parent
4a19634f07
commit
691b20bec0
@ -42,6 +42,16 @@ struct timezone {
|
||||
int tz_minuteswest;
|
||||
int tz_dsttime;
|
||||
};
|
||||
#define timerisset(t) ((t)->tv_sec || (t)->tv_usec)
|
||||
#define timerclear(t) ((t)->tv_sec = (t)->tv_usec = 0)
|
||||
#define timercmp(s,t,op) ((s)->tv_sec == (t)->tv_sec ? \
|
||||
(s)->tv_usec op (t)->tv_usec : (s)->tv_sec op (t)->tv_sec)
|
||||
#define timeradd(s,t,a) ( (a)->tv_sec = (s)->tv_sec + (t)->tv_sec, \
|
||||
((a)->tv_usec = (s)->tv_usec + (t)->tv_usec) >= 1000000 && \
|
||||
((a)->tv_usec -= 1000000, (a)->tv_sec++) )
|
||||
#define timersub(s,t,a) ( (a)->tv_sec = (s)->tv_sec - (t)->tv_sec, \
|
||||
((a)->tv_usec = (s)->tv_usec - (t)->tv_usec) < 0 && \
|
||||
((a)->tv_usec += 1000000, (a)->tv_sec--) )
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Loading…
Reference in New Issue
Block a user