diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-03-28 04:09:41 +0100 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-03-28 04:09:41 +0100 |
commit | 1d90b89bca58066016225d3ed721c167597a0ee5 (patch) | |
tree | d90423cdeb6ab01329ef54aefbbd0de65f94d10b /Modules/timemodule.c | |
parent | 92ab17f9200c135ec9d951e734c02ed57a77d803 (diff) | |
download | cpython-1d90b89bca58066016225d3ed721c167597a0ee5.tar.gz |
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.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 21e6f433ff..3178fcbf03 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) { |