summaryrefslogtreecommitdiffstats
path: root/Modules/timemodule.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-03-28 03:09:41 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-03-28 03:09:41 (GMT)
commitb3b454407058cd57d8a401a5aeb018d4ccb87616 (patch)
treeb1e53ecf7dd67abfd8b1573e16c02210391f06d1 /Modules/timemodule.c
parentc337838af798354603457043e2ad8cfd3cbea36e (diff)
downloadcpython-b3b454407058cd57d8a401a5aeb018d4ccb87616.zip
cpython-b3b454407058cd57d8a401a5aeb018d4ccb87616.tar.gz
cpython-b3b454407058cd57d8a401a5aeb018d4ccb87616.tar.bz2
Issue #22117: Use the _PyTime_t API for time.clock_settime()
Remove also the now unused _PyTime_AddDouble() function.
Diffstat (limited to 'Modules/timemodule.c')
-rw-r--r--Modules/timemodule.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index 21e6f43..3178fcb 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -166,18 +166,18 @@ time_clock_settime(PyObject *self, PyObject *args)
{
int clk_id;
PyObject *obj;
- time_t tv_sec;
- long tv_nsec;
+ _PyTime_t t;
struct timespec tp;
int ret;
if (!PyArg_ParseTuple(args, "iO:clock_settime", &clk_id, &obj))
return NULL;
- if (_PyTime_ObjectToTimespec(obj, &tv_sec, &tv_nsec, _PyTime_ROUND_DOWN) == -1)
+ if (_PyTime_FromSecondsObject(&t, obj, _PyTime_ROUND_DOWN) < 0)
+ return NULL;
+
+ if (_PyTime_AsTimespec(t, &tp) == -1)
return NULL;
- tp.tv_sec = tv_sec;
- tp.tv_nsec = tv_nsec;
ret = clock_settime((clockid_t)clk_id, &tp);
if (ret != 0) {