Files for 2.1b1 distribution.
[python/dscho.git] / Modules / timingmodule.c
blob184469679b8f743b90f794214be8ff49640d13ee
1 /*
2 * Author: George V. Neville-Neil
3 */
5 #include "Python.h"
7 /* Our stuff... */
8 #include "timing.h"
10 static PyObject *
11 start_timing(PyObject *self, PyObject *args)
13 if (!PyArg_Parse(args, ""))
14 return NULL;
16 Py_INCREF(Py_None);
17 BEGINTIMING;
18 return Py_None;
21 static PyObject *
22 finish_timing(PyObject *self, PyObject *args)
24 if (!PyArg_Parse(args, ""))
25 return NULL;
27 ENDTIMING
28 Py_INCREF(Py_None);
29 return Py_None;
32 static PyObject *
33 seconds(PyObject *self, PyObject *args)
35 if (!PyArg_Parse(args, ""))
36 return NULL;
38 return PyInt_FromLong(TIMINGS);
42 static PyObject *
43 milli(PyObject *self, PyObject *args)
45 if (!PyArg_Parse(args, ""))
46 return NULL;
48 return PyInt_FromLong(TIMINGMS);
51 static PyObject *
52 micro(PyObject *self, PyObject *args)
54 if (!PyArg_Parse(args, ""))
55 return NULL;
57 return PyInt_FromLong(TIMINGUS);
62 static PyMethodDef timing_methods[] = {
63 {"start", start_timing},
64 {"finish", finish_timing},
65 {"seconds", seconds},
66 {"milli", milli},
67 {"micro", micro},
68 {NULL, NULL}
72 DL_EXPORT(void) inittiming(void)
74 (void)Py_InitModule("timing", timing_methods);