summaryrefslogtreecommitdiffstats
path: root/Modules/clinic/timemodule.c.h
blob: bbc0748f9a9c0ddf5dbb3fb3e3ddb8c81f1acb2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*[clinic input]
preserve
[clinic start generated code]*/

#if defined(HAVE_CLOCK_GETTIME)

PyDoc_STRVAR(time_clock_gettime__doc__,
"clock_gettime($module, clk_id, /)\n"
"--\n"
"\n"
"Return the time of the specified clock clk_id as a float.");

#define TIME_CLOCK_GETTIME_METHODDEF    \
    {"clock_gettime", (PyCFunction)time_clock_gettime, METH_O, time_clock_gettime__doc__},

static PyObject *
time_clock_gettime_impl(PyObject *module, clockid_t clk_id);

static PyObject *
time_clock_gettime(PyObject *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    clockid_t clk_id;

    if (!time_clockid_converter(arg, &clk_id)) {
        goto exit;
    }
    return_value = time_clock_gettime_impl(module, clk_id);

exit:
    return return_value;
}

#endif /* defined(HAVE_CLOCK_GETTIME) */

#if defined(HAVE_CLOCK_GETTIME)

PyDoc_STRVAR(time_clock_gettime_ns__doc__,
"clock_gettime_ns($module, clk_id, /)\n"
"--\n"
"\n"
"Return the time of the specified clock clk_id as nanoseconds (int).");

#define TIME_CLOCK_GETTIME_NS_METHODDEF    \
    {"clock_gettime_ns", (PyCFunction)time_clock_gettime_ns, METH_O, time_clock_gettime_ns__doc__},

static PyObject *
time_clock_gettime_ns_impl(PyObject *module, clockid_t clk_id);

static PyObject *
time_clock_gettime_ns(PyObject *module, PyObject *arg)
{
    PyObject *return_value = NULL;
    clockid_t clk_id;

    if (!time_clockid_converter(arg, &clk_id)) {
        goto exit;
    }
    return_value = time_clock_gettime_ns_impl(module, clk_id);

exit:
    return return_value;
}

#endif /* defined(HAVE_CLOCK_GETTIME) */

#ifndef TIME_CLOCK_GETTIME_METHODDEF
    #define TIME_CLOCK_GETTIME_METHODDEF
#endif /* !defined(TIME_CLOCK_GETTIME_METHODDEF) */

#ifndef TIME_CLOCK_GETTIME_NS_METHODDEF
    #define TIME_CLOCK_GETTIME_NS_METHODDEF
#endif /* !defined(TIME_CLOCK_GETTIME_NS_METHODDEF) */
/*[clinic end generated code: output=b589a2132aa9df47 input=a9049054013a1b77]*/