diff -r f60e16663f6e Modules/timemodule.c --- a/Modules/timemodule.c Sat Aug 06 13:48:10 2016 -0700 +++ b/Modules/timemodule.c Sun Sep 11 20:21:45 2016 +0200 @@ -160,7 +160,9 @@ "clock_gettime(clk_id) -> floating point number\n\ \n\ Return the time of the specified clock clk_id."); +#endif /* HAVE_CLOCK_GETTIME */ +#ifdef HAVE_CLOCK_SETTIME static PyObject * time_clock_settime(PyObject *self, PyObject *args) { @@ -191,7 +193,9 @@ "clock_settime(clk_id, time)\n\ \n\ Set the time of the specified clock clk_id."); +#endif /* HAVE_CLOCK_SETTIME */ +#ifdef HAVE_CLOCK_GETRES static PyObject * time_clock_getres(PyObject *self, PyObject *args) { @@ -215,7 +219,7 @@ "clock_getres(clk_id) -> floating point number\n\ \n\ Return the resolution (precision) of the specified clock clk_id."); -#endif /* HAVE_CLOCK_GETTIME */ +#endif /* HAVE_CLOCK_GETRES */ static PyObject * time_sleep(PyObject *self, PyObject *obj) @@ -1226,8 +1230,9 @@ #endif /* __CYGWIN__ */ #endif /* !HAVE_TZNAME || __GLIBC__ || __CYGWIN__*/ -#if defined(HAVE_CLOCK_GETTIME) +#ifdef CLOCK_REALTIME PyModule_AddIntMacro(m, CLOCK_REALTIME); +#endif #ifdef CLOCK_MONOTONIC PyModule_AddIntMacro(m, CLOCK_MONOTONIC); #endif @@ -1243,7 +1248,6 @@ #ifdef CLOCK_THREAD_CPUTIME_ID PyModule_AddIntMacro(m, CLOCK_THREAD_CPUTIME_ID); #endif -#endif /* HAVE_CLOCK_GETTIME */ } @@ -1254,7 +1258,11 @@ #endif #ifdef HAVE_CLOCK_GETTIME {"clock_gettime", time_clock_gettime, METH_VARARGS, clock_gettime_doc}, +#endif +#ifdef HAVE_CLOCK_SETTIME {"clock_settime", time_clock_settime, METH_VARARGS, clock_settime_doc}, +#endif +#ifdef HAVE_CLOCK_GETRES {"clock_getres", time_clock_getres, METH_VARARGS, clock_getres_doc}, #endif {"sleep", time_sleep, METH_O, sleep_doc}, diff -r f60e16663f6e configure.ac --- a/configure.ac Sat Aug 06 13:48:10 2016 -0700 +++ b/configure.ac Sun Sep 11 20:21:45 2016 +0200 @@ -3625,6 +3625,12 @@ ]) ]) +AC_CHECK_FUNCS(clock_settime, [], [ + AC_CHECK_LIB(rt, clock_settime, [ + AC_DEFINE(HAVE_CLOCK_SETTIME, 1) + ]) +]) + AC_MSG_CHECKING(for major, minor, and makedev) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #if defined(MAJOR_IN_MKDEV) diff -r f60e16663f6e pyconfig.h.in --- a/pyconfig.h.in Sat Aug 06 13:48:10 2016 -0700 +++ b/pyconfig.h.in Sun Sep 11 20:21:45 2016 +0200 @@ -128,6 +128,9 @@ /* Define to 1 if you have the `clock_gettime' function. */ #undef HAVE_CLOCK_GETTIME +/* Define to 1 if you have the `clock_settime' function. */ +#undef HAVE_CLOCK_SETTIME + /* Define if the C compiler supports computed gotos. */ #undef HAVE_COMPUTED_GOTOS