summaryrefslogtreecommitdiffstats
path: root/Modules/_testcapimodule.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-04-03 11:10:54 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-04-03 11:10:54 (GMT)
commit13019fdef3b6d589f8d7602943c76fcc637114ea (patch)
tree975aa7bea2e9e07236ef08b4e485e46079ff5b9f /Modules/_testcapimodule.c
parent21dfffa218be821af03bc3cdf928a62e9431aaf8 (diff)
downloadcpython-13019fdef3b6d589f8d7602943c76fcc637114ea.zip
cpython-13019fdef3b6d589f8d7602943c76fcc637114ea.tar.gz
cpython-13019fdef3b6d589f8d7602943c76fcc637114ea.tar.bz2
Issue #22117: Add a new _PyTime_FromSeconds() function
Fix also _Py_InitializeEx_Private(): initialize time before initializing import, import_init() uses the _PyTime API (for thread locks).
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r--Modules/_testcapimodule.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 7b4f239..d6eb6d4 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -3383,6 +3383,18 @@ return_result_with_error(PyObject *self, PyObject *args)
}
static PyObject *
+test_pytime_fromseconds(PyObject *self, PyObject *args)
+{
+ int seconds;
+ _PyTime_t ts;
+
+ if (!PyArg_ParseTuple(args, "i", &seconds))
+ return NULL;
+ ts = _PyTime_FromSeconds(seconds);
+ return _PyTime_AsNanosecondsObject(ts);
+}
+
+static PyObject *
test_pytime_fromsecondsobject(PyObject *self, PyObject *args)
{
PyObject *obj;
@@ -3651,6 +3663,7 @@ static PyMethodDef TestMethods[] = {
return_null_without_error, METH_NOARGS},
{"return_result_with_error",
return_result_with_error, METH_NOARGS},
+ {"PyTime_FromSeconds", test_pytime_fromseconds, METH_VARARGS},
{"PyTime_FromSecondsObject", test_pytime_fromsecondsobject, METH_VARARGS},
{"PyTime_AsSecondsDouble", test_pytime_assecondsdouble, METH_VARARGS},
{"PyTime_AsTimeval", test_PyTime_AsTimeval, METH_VARARGS},