Staging
v0.5.0
https://github.com/python/cpython
Raw File
Tip revision: 1ad37bb508b990d73a76fdbeae9cb5aeadd0b4b0 authored by cvs2svn on 23 March 2001, 20:24:07 UTC
This commit was manufactured by cvs2svn to create tag 'r21b2'.
Tip revision: 1ad37bb
timingmodule.c
/*
 * Author: George V. Neville-Neil
 */

#include "Python.h"

/* Our stuff... */
#include "timing.h"

static PyObject *
start_timing(PyObject *self, PyObject *args)
{
	if (!PyArg_Parse(args, ""))
		return NULL;

	Py_INCREF(Py_None);
	BEGINTIMING;
	return Py_None;
}

static PyObject *
finish_timing(PyObject *self, PyObject *args)
{
	if (!PyArg_Parse(args, ""))
		return NULL;

	ENDTIMING    
	Py_INCREF(Py_None);
	return Py_None;
}

static PyObject *
seconds(PyObject *self, PyObject *args)
{
	if (!PyArg_Parse(args, ""))
		return NULL;

	return PyInt_FromLong(TIMINGS);

}

static PyObject *
milli(PyObject *self, PyObject *args)
{
	if (!PyArg_Parse(args, ""))
		return NULL;

	return PyInt_FromLong(TIMINGMS);

}
static PyObject *
micro(PyObject *self, PyObject *args)
{
	if (!PyArg_Parse(args, ""))
		return NULL;

	return PyInt_FromLong(TIMINGUS);

}


static PyMethodDef timing_methods[] = {
	{"start",   start_timing},
	{"finish",  finish_timing},
	{"seconds", seconds},
	{"milli",   milli},
	{"micro",   micro},
	{NULL,      NULL}
};


DL_EXPORT(void) inittiming(void)
{
	(void)Py_InitModule("timing", timing_methods);
}
back to top