Fix clock_gettime/getres/settime: PyArg_ParseTuple() expects an int
Only use a single #ifdef for the 3 functions.
This commit is contained in:
parent
0682a0c0a9
commit
b8d016955a
@ -139,7 +139,7 @@ static PyObject *
|
|||||||
time_clock_gettime(PyObject *self, PyObject *args)
|
time_clock_gettime(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
clockid_t clk_id;
|
int clk_id;
|
||||||
struct timespec tp;
|
struct timespec tp;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "i:clock_gettime", &clk_id))
|
if (!PyArg_ParseTuple(args, "i:clock_gettime", &clk_id))
|
||||||
@ -162,7 +162,7 @@ Return the time of the specified clock clk_id.");
|
|||||||
static PyObject *
|
static PyObject *
|
||||||
time_clock_settime(PyObject *self, PyObject *args)
|
time_clock_settime(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
clockid_t clk_id;
|
int clk_id;
|
||||||
PyObject *obj;
|
PyObject *obj;
|
||||||
struct timespec tp;
|
struct timespec tp;
|
||||||
int ret;
|
int ret;
|
||||||
@ -185,14 +185,12 @@ PyDoc_STRVAR(clock_settime_doc,
|
|||||||
"clock_settime(clk_id, time)\n\
|
"clock_settime(clk_id, time)\n\
|
||||||
\n\
|
\n\
|
||||||
Set the time of the specified clock clk_id.");
|
Set the time of the specified clock clk_id.");
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_CLOCK_GETRES
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
time_clock_getres(PyObject *self, PyObject *args)
|
time_clock_getres(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
clockid_t clk_id;
|
int clk_id;
|
||||||
struct timespec tp;
|
struct timespec tp;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "i:clock_getres", &clk_id))
|
if (!PyArg_ParseTuple(args, "i:clock_getres", &clk_id))
|
||||||
@ -211,7 +209,7 @@ PyDoc_STRVAR(clock_getres_doc,
|
|||||||
"clock_getres(clk_id) -> floating point number\n\
|
"clock_getres(clk_id) -> floating point number\n\
|
||||||
\n\
|
\n\
|
||||||
Return the resolution (precision) of the specified clock clk_id.");
|
Return the resolution (precision) of the specified clock clk_id.");
|
||||||
#endif
|
#endif /* HAVE_CLOCK_GETTIME */
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
time_sleep(PyObject *self, PyObject *args)
|
time_sleep(PyObject *self, PyObject *args)
|
||||||
@ -1009,11 +1007,7 @@ static PyMethodDef time_methods[] = {
|
|||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CLOCK_GETTIME
|
#ifdef HAVE_CLOCK_GETTIME
|
||||||
{"clock_gettime", time_clock_gettime, METH_VARARGS, clock_gettime_doc},
|
{"clock_gettime", time_clock_gettime, METH_VARARGS, clock_gettime_doc},
|
||||||
#endif
|
|
||||||
#ifdef HAVE_CLOCK_GETTIME
|
|
||||||
{"clock_settime", time_clock_settime, METH_VARARGS, clock_settime_doc},
|
{"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},
|
{"clock_getres", time_clock_getres, METH_VARARGS, clock_getres_doc},
|
||||||
#endif
|
#endif
|
||||||
{"sleep", time_sleep, METH_VARARGS, sleep_doc},
|
{"sleep", time_sleep, METH_VARARGS, sleep_doc},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user