Land #372, Add CLOCK_MONOTONIC and timersub compatibility stubs

This commit is contained in:
Brent Cook 2017-12-28 03:38:41 -06:00
commit 9a7fb37405

View File

@ -13,4 +13,20 @@ int gettimeofday(struct timeval *tp, void *tzp);
#include_next <sys/time.h>
#endif
#ifndef CLOCK_MONOTONIC
#define CLOCK_MONOTONIC CLOCK_REALTIME
#endif
#ifndef timersub
#define timersub(tvp, uvp, vvp) \
do { \
(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
(vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
if ((vvp)->tv_usec < 0) { \
(vvp)->tv_sec--; \
(vvp)->tv_usec += 1000000; \
} \
} while (0)
#endif
#endif