summaryrefslogtreecommitdiffstats
path: root/Include/pytime.h
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-03-27 16:12:45 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-03-27 16:12:45 (GMT)
commit992c43fec900e204deffc026318b97ab0f83eff6 (patch)
tree17cb58a91cb6a44d7d53124d9e84a7ba535dca6e /Include/pytime.h
parent79644f9c83b3cd992c16c6e1bd6c7a5fd49f24c0 (diff)
downloadcpython-992c43fec900e204deffc026318b97ab0f83eff6.zip
cpython-992c43fec900e204deffc026318b97ab0f83eff6.tar.gz
cpython-992c43fec900e204deffc026318b97ab0f83eff6.tar.bz2
Issue #22117: Fix rounding in _PyTime_FromSecondsObject()
* Rename _PyTime_FromObject() to _PyTime_FromSecondsObject() * Add _PyTime_AsNanosecondsObject() and _testcapi.pytime_fromsecondsobject() * Add unit tests
Diffstat (limited to 'Include/pytime.h')
-rw-r--r--Include/pytime.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/Include/pytime.h b/Include/pytime.h
index 9cf1170..78e4ae9 100644
--- a/Include/pytime.h
+++ b/Include/pytime.h
@@ -121,15 +121,18 @@ typedef PY_INT64_T _PyTime_t;
/* Convert a Python float or int to a timetamp.
Raise an exception and return -1 on error, return 0 on success. */
-PyAPI_FUNC(int) _PyTime_FromObject(_PyTime_t *t,
+PyAPI_FUNC(int) _PyTime_FromSecondsObject(_PyTime_t *t,
PyObject *obj,
_PyTime_round_t round);
/* Convert timestamp to a number of milliseconds (10^-3 seconds). */
-PyAPI_FUNC(_PyTime_t)
-_PyTime_AsMilliseconds(_PyTime_t t,
+PyAPI_FUNC(_PyTime_t) _PyTime_AsMilliseconds(_PyTime_t t,
_PyTime_round_t round);
+/* Convert timestamp to a number of nanoseconds (10^-9 seconds) as a Python int
+ object. */
+PyAPI_FUNC(PyObject *) _PyTime_AsNanosecondsObject(_PyTime_t t);
+
/* Convert a timestamp to a timeval structure. */
PyAPI_FUNC(int) _PyTime_AsTimeval(_PyTime_t t,
struct timeval *tv,