source: python/vendor/Python-2.7.6/Modules/timingmodule.c

Last change on this file was 388, checked in by dmik, 11 years ago

python: Update vendor to 2.7.6.

  • Property svn:eol-style set to native
File size: 1.1 KB
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 if (PyErr_WarnPy3k("the timing module has been removed in "
58 "Python 3.0; use time.clock() instead", 2) < 0)
59 return;
60
61 (void)Py_InitModule("timing", timing_methods);
62}
Note: See TracBrowser for help on using the repository browser.