2.6-alpha3 build failure on macOS 10.12: redefinition of clock_gettime


compat.c defines clock_gettime when there's no clock_gettime in librt.
However, clock_gettime has been available since macOS 10.12;
AC_CHECK_LIB([rt], [clock_gettime], ...) doesn't work simply because
there's no librt on macOS. This results in a redefinition on macOS 10.12:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/time.h:177:5: error: conflicting types for 'clock_gettime' int clock_gettime(clockid_t __clock_id, struct timespec *__tp); ^ ../../compat.h:56:5: note: previous declaration is here int clock_gettime (int clk_id, struct timespec *ts); ^ 1 error generated.

You can find the man page clock_gettime.3 on macOS 10.12 at https://git.io/v13eF.

Fixed by commit r2936.

For the record, this is patched in Homebrew in https://github.com/Homebrew/homebrew-core/pull/7734.