diff options
author | Benjamin Peterson <benjamin@python.org> | 2016-09-14 05:55:09 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2016-09-14 05:55:09 (GMT) |
commit | 37098cd5848558f092ae26978369590b993132c3 (patch) | |
tree | 48eb54c9b8237dc142b62e64a1a0c7ff563ac469 /Modules/timemodule.c | |
parent | 54bb13bdfd59d68dcf0bfa2171b903695d9e9f87 (diff) | |
download | cpython-37098cd5848558f092ae26978369590b993132c3.zip cpython-37098cd5848558f092ae26978369590b993132c3.tar.gz cpython-37098cd5848558f092ae26978369590b993132c3.tar.bz2 |
more granular configure checks for clock_* functions (closes #28081)
Diffstat (limited to 'Modules/timemodule.c')
-rw-r--r-- | Modules/timemodule.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c index ea7d906..8194fd9 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -160,7 +160,9 @@ PyDoc_STRVAR(clock_gettime_doc, "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 @@ PyDoc_STRVAR(clock_settime_doc, "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 @@ PyDoc_STRVAR(clock_getres_doc, "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) @@ -1287,7 +1291,11 @@ static PyMethodDef time_methods[] = { #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}, @@ -1383,8 +1391,9 @@ PyInit_time(void) /* Set, or reset, module variables like time.timezone */ PyInit_timezone(m); -#if defined(HAVE_CLOCK_GETTIME) +#ifdef CLOCK_REALTIME PyModule_AddIntMacro(m, CLOCK_REALTIME); +#endif #ifdef CLOCK_MONOTONIC PyModule_AddIntMacro(m, CLOCK_MONOTONIC); #endif @@ -1400,7 +1409,6 @@ PyInit_time(void) #ifdef CLOCK_THREAD_CPUTIME_ID PyModule_AddIntMacro(m, CLOCK_THREAD_CPUTIME_ID); #endif -#endif /* HAVE_CLOCK_GETTIME */ if (!initialized) { if (PyStructSequence_InitType2(&StructTimeType, |