Issue 28081: [Patch] timemodule: Complete Autoconf bits for clock_*() functions: make clock_getres() and clock_settime() optional (original) (raw)

Our Autoconf bits already test for the presence of the POSIX 2008 clock_gettime() and clock_getres() functions, which is nice. Still, I'd like to make two improvements there:

  1. In timemodule.c, properly guard the use of clock_getres() bits with HAVE_CLOCK_GETRES instead of using HAVE_CLOCK_GETTIME. There don't seem to be any shared functions/structures/etc., so we can safely decouple them.

  2. For consistency, also add Autoconf bits for clock_settime(). In timemodule.c, use HAVE_CLOCK_SETTIME as a guard.

The reason why I'm sending in this patch is because CloudABI (https://mail.python.org/pipermail/python-dev/2016-July/145708.html) does provide clock_gettime() and clock_getres(), but not clock_settime(). The reason for this is that CloudABI is meant for running unprivileged/sandboxed code. There is no need to provide an API for adjusting system-wide clocks.

Do note that this patch does not contain any changes to Autoconf generated files.