Staging
v0.5.1
https://github.com/python/cpython
Revision 703ad705c34deba4b559fd9e62c380dcbdc6861e authored by Martin v. Löwis on 05 September 2001, 08:36:52 UTC, committed by Martin v. Löwis on 05 September 2001, 08:36:52 UTC
1 parent a5f8bb5
Raw File
Tip revision: 703ad705c34deba4b559fd9e62c380dcbdc6861e authored by Martin v. Löwis on 05 September 2001, 08:36:52 UTC
Use -fPIC instead of -fpic for gcc on HP/UX. Fixes bug #433234.
Tip revision: 703ad70
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