diff --git a/include/compat/sys/time.h b/include/compat/sys/time.h index 235bc6e..3d31985 100644 --- a/include/compat/sys/time.h +++ b/include/compat/sys/time.h @@ -13,4 +13,20 @@ int gettimeofday(struct timeval *tp, void *tzp); #include_next #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