diff options
| author | Brent Cook <bcook@openbsd.org> | 2017-12-28 03:38:41 -0600 |
|---|---|---|
| committer | Brent Cook <bcook@openbsd.org> | 2017-12-28 03:38:41 -0600 |
| commit | 9a7fb374052b0fc546db2331cbcd9c1419fdbdfd (patch) | |
| tree | 8a66f7d0fbdba0a15e09c95350d354fd5fcaa56a /include | |
| parent | f69775d7b2d3a248e6f0c934cf88d6f75ae91bdc (diff) | |
| parent | 965a89108e09172d30e8f4922fe67414b41600b2 (diff) | |
| download | portable-9a7fb374052b0fc546db2331cbcd9c1419fdbdfd.tar.gz portable-9a7fb374052b0fc546db2331cbcd9c1419fdbdfd.tar.bz2 portable-9a7fb374052b0fc546db2331cbcd9c1419fdbdfd.zip | |
Land #372, Add CLOCK_MONOTONIC and timersub compatibility stubs
Diffstat (limited to 'include')
| -rw-r--r-- | include/compat/sys/time.h | 16 |
1 files changed, 16 insertions, 0 deletions
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); | |||
| 13 | #include_next <sys/time.h> | 13 | #include_next <sys/time.h> |
| 14 | #endif | 14 | #endif |
| 15 | 15 | ||
| 16 | #ifndef CLOCK_MONOTONIC | ||
| 17 | #define CLOCK_MONOTONIC CLOCK_REALTIME | ||
| 18 | #endif | ||
| 19 | |||
| 20 | #ifndef timersub | ||
| 21 | #define timersub(tvp, uvp, vvp) \ | ||
| 22 | do { \ | ||
| 23 | (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ | ||
| 24 | (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \ | ||
| 25 | if ((vvp)->tv_usec < 0) { \ | ||
| 26 | (vvp)->tv_sec--; \ | ||
| 27 | (vvp)->tv_usec += 1000000; \ | ||
| 28 | } \ | ||
| 29 | } while (0) | ||
| 30 | #endif | ||
| 31 | |||
| 16 | #endif | 32 | #endif |
