summaryrefslogtreecommitdiffstats
path: root/Python/pytime.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/pytime.c')
-rw-r--r--Python/pytime.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/Python/pytime.c b/Python/pytime.c
index e7dadc7..db3f683 100644
--- a/Python/pytime.c
+++ b/Python/pytime.c
@@ -96,6 +96,17 @@ _PyLong_AsTime_t(PyObject *obj)
return (time_t)val;
}
+PyObject *
+_PyLong_FromTime_t(time_t t)
+{
+#if defined(HAVE_LONG_LONG) && SIZEOF_TIME_T == SIZEOF_LONG_LONG
+ return PyLong_FromLongLong((PY_LONG_LONG)t);
+#else
+ assert(sizeof(time_t) <= sizeof(long));
+ return PyLong_FromLong((long)t);
+#endif
+}
+
static int
_PyTime_ObjectToDenominator(PyObject *obj, time_t *sec, long *numerator,
double denominator)