Coverage Report

Created: 2025-07-04 06:49

/src/cpython/Modules/clinic/timemodule.c.h
Line
Count
Source (jump to first uncovered line)
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
0
{
22
0
    PyObject *return_value = NULL;
23
0
    clockid_t clk_id;
24
25
0
    if (!time_clockid_converter(arg, &clk_id)) {
26
0
        goto exit;
27
0
    }
28
0
    return_value = time_clock_gettime_impl(module, clk_id);
29
30
0
exit:
31
0
    return return_value;
32
0
}
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
0
{
53
0
    PyObject *return_value = NULL;
54
0
    clockid_t clk_id;
55
56
0
    if (!time_clockid_converter(arg, &clk_id)) {
57
0
        goto exit;
58
0
    }
59
0
    return_value = time_clock_gettime_ns_impl(module, clk_id);
60
61
0
exit:
62
0
    return return_value;
63
0
}
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]*/