source: python/trunk/Modules/timingmodule.c

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

python: Merge vendor 2.7.6 to trunk.

  • Property svn:eol-style set to native
File size: 1.1 KB
RevLine 
[2]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{
[391]13 Py_INCREF(Py_None);
14 BEGINTIMING;
15 return Py_None;
[2]16}
17
18static PyObject *
19finish_timing(PyObject *self)
20{
[391]21 ENDTIMING
22 Py_INCREF(Py_None);
23 return Py_None;
[2]24}
25
26static PyObject *
27seconds(PyObject *self)
28{
[391]29 return PyInt_FromLong(TIMINGS);
[2]30}
31
32static PyObject *
33milli(PyObject *self)
34{
[391]35 return PyInt_FromLong(TIMINGMS);
[2]36}
37
38static PyObject *
39micro(PyObject *self)
40{
[391]41 return PyInt_FromLong(TIMINGUS);
[2]42}
43
44
45static PyMethodDef timing_methods[] = {
[391]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}
[2]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)
[391]59 return;
60
61 (void)Py_InitModule("timing", timing_methods);
[2]62}
Note: See TracBrowser for help on using the repository browser.