source: vendor/python/2.5/Modules/timingmodule.c

Last change on this file was 3225, checked in by bird, 18 years ago

Python 2.5

File size: 952 bytes
Line 
1/*
2 * Author: George V. Neville-Neil
3 */
4
5#include "Python.h"
6
7/* Our stuff... */
8#include "timing.h"
9
10static PyObject *
11start_timing(PyObject *self)
12{
13 Py_INCREF(Py_None);
14 BEGINTIMING;
15 return Py_None;
16}
17
18static PyObject *
19finish_timing(PyObject *self)
20{
21 ENDTIMING
22 Py_INCREF(Py_None);
23 return Py_None;
24}
25
26static PyObject *
27seconds(PyObject *self)
28{
29 return PyInt_FromLong(TIMINGS);
30}
31
32static PyObject *
33milli(PyObject *self)
34{
35 return PyInt_FromLong(TIMINGMS);
36}
37
38static PyObject *
39micro(PyObject *self)
40{
41 return PyInt_FromLong(TIMINGUS);
42}
43
44
45static PyMethodDef timing_methods[] = {
46 {"start", (PyCFunction)start_timing, METH_NOARGS},
47 {"finish", (PyCFunction)finish_timing, METH_NOARGS},
48 {"seconds", (PyCFunction)seconds, METH_NOARGS},
49 {"milli", (PyCFunction)milli, METH_NOARGS},
50 {"micro", (PyCFunction)micro, METH_NOARGS},
51 {NULL, NULL}
52};
53
54
55PyMODINIT_FUNC inittiming(void)
56{
57 (void)Py_InitModule("timing", timing_methods);
58}
Note: See TracBrowser for help on using the repository browser.