4 static PyObject
*meth_getdate(PyObject
*me
, PyObject
*arg
, PyObject
*kw
)
9 static char *kwlist
[] = { "string", "now", 0 };
11 if (!PyArg_ParseTupleAndKeywords(arg
, kw
, "s|i:getdate", kwlist
,
14 if (tnow
!= -1) now
= tnow
;
15 if ((t
= get_date(p
, (tnow
== -1) ?
0 : &now
)) == (time_t)-1) {
16 PyErr_SetString(PyExc_SyntaxError
, "Bad time string");
19 return (PyInt_FromLong(t
));
22 static PyMethodDef methods
[] = {
23 { "getdate", (PyCFunction
)meth_getdate
, METH_VARARGS
| METH_KEYWORDS
,
24 "getdate(STRING, now = time.time()) -> TIME" },
28 void initgetdate(void) { Py_InitModule("getdate", methods
); }