diff options
author | Larry Hastings <larry@hastings.org> | 2012-04-19 22:07:49 (GMT) |
---|---|---|
committer | Larry Hastings <larry@hastings.org> | 2012-04-19 22:07:49 (GMT) |
commit | 6fe20b3aee076850e390ef8bb2078b1cd09ddf88 (patch) | |
tree | 235f93dbd1d92f3983b6e4a4f1d84db296420365 /Python/pytime.c | |
parent | dd5aa36f179011f390a0cc6fb4ba7bba1764f1a9 (diff) | |
download | cpython-6fe20b3aee076850e390ef8bb2078b1cd09ddf88.zip cpython-6fe20b3aee076850e390ef8bb2078b1cd09ddf88.tar.gz cpython-6fe20b3aee076850e390ef8bb2078b1cd09ddf88.tar.bz2 |
Issue #14127: Add st_{cma}time_ns fields to os.stat() result object.
Diffstat (limited to 'Python/pytime.c')
-rw-r--r-- | Python/pytime.c | 11 |
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) |