| 1 |
/*[clinic input] |
| 2 |
preserve |
| 3 |
[clinic start generated code]*/ |
| 4 |
|
| 5 |
#if defined(HAVE_CLOCK_GETTIME) |
| 6 |
|
| 7 |
PyDoc_STRVAR(time_clock_gettime__doc__, |
| 8 |
"clock_gettime($module, clk_id, /)\n" |
| 9 |
"--\n" |
| 10 |
"\n" |
| 11 |
"Return the time of the specified clock clk_id as a float."); |
| 12 |
|
| 13 |
#define TIME_CLOCK_GETTIME_METHODDEF \ |
| 14 |
{"clock_gettime", (PyCFunction)time_clock_gettime, METH_O, time_clock_gettime__doc__}, |
| 15 |
|
| 16 |
static PyObject * |
| 17 |
time_clock_gettime_impl(PyObject *module, clockid_t clk_id); |
| 18 |
|
| 19 |
static PyObject * |
| 20 |
time_clock_gettime(PyObject *module, PyObject *arg) |
| 21 |
{ |
| 22 |
PyObject *return_value = NULL; |
| 23 |
clockid_t clk_id; |
| 24 |
|
| 25 |
if (!time_clockid_converter(arg, &clk_id)) { |
| 26 |
goto exit; |
| 27 |
} |
| 28 |
return_value = time_clock_gettime_impl(module, clk_id); |
| 29 |
|
| 30 |
exit: |
| 31 |
return return_value; |
| 32 |
} |
| 33 |
|
| 34 |
#endif /* defined(HAVE_CLOCK_GETTIME) */ |
| 35 |
|
| 36 |
#if defined(HAVE_CLOCK_GETTIME) |
| 37 |
|
| 38 |
PyDoc_STRVAR(time_clock_gettime_ns__doc__, |
| 39 |
"clock_gettime_ns($module, clk_id, /)\n" |
| 40 |
"--\n" |
| 41 |
"\n" |
| 42 |
"Return the time of the specified clock clk_id as nanoseconds (int)."); |
| 43 |
|
| 44 |
#define TIME_CLOCK_GETTIME_NS_METHODDEF \ |
| 45 |
{"clock_gettime_ns", (PyCFunction)time_clock_gettime_ns, METH_O, time_clock_gettime_ns__doc__}, |
| 46 |
|
| 47 |
static PyObject * |
| 48 |
time_clock_gettime_ns_impl(PyObject *module, clockid_t clk_id); |
| 49 |
|
| 50 |
static PyObject * |
| 51 |
time_clock_gettime_ns(PyObject *module, PyObject *arg) |
| 52 |
{ |
| 53 |
PyObject *return_value = NULL; |
| 54 |
clockid_t clk_id; |
| 55 |
|
| 56 |
if (!time_clockid_converter(arg, &clk_id)) { |
| 57 |
goto exit; |
| 58 |
} |
| 59 |
return_value = time_clock_gettime_ns_impl(module, clk_id); |
| 60 |
|
| 61 |
exit: |
| 62 |
return return_value; |
| 63 |
} |
| 64 |
|
| 65 |
#endif /* defined(HAVE_CLOCK_GETTIME) */ |
| 66 |
|
| 67 |
#ifndef TIME_CLOCK_GETTIME_METHODDEF |
| 68 |
#define TIME_CLOCK_GETTIME_METHODDEF |
| 69 |
#endif /* !defined(TIME_CLOCK_GETTIME_METHODDEF) */ |
| 70 |
|
| 71 |
#ifndef TIME_CLOCK_GETTIME_NS_METHODDEF |
| 72 |
#define TIME_CLOCK_GETTIME_NS_METHODDEF |
| 73 |
#endif /* !defined(TIME_CLOCK_GETTIME_NS_METHODDEF) */ |
| 74 |
/*[clinic end generated code: output=b589a2132aa9df47 input=a9049054013a1b77]*/ |