From a32c99412914058f47bc50336c7c83d38331e880 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Mon, 9 Sep 2002 16:17:47 +0000 Subject: [PATCH] Always generate floats for stat_result; fix configure test. --- Doc/lib/libos.tex | 11 +++++------ Misc/NEWS | 3 +-- Modules/posixmodule.c | 10 +--------- configure | 4 ++-- configure.in | 2 +- 5 files changed, 10 insertions(+), 20 deletions(-) diff --git a/Doc/lib/libos.tex b/Doc/lib/libos.tex index b1adc1b3d3d..5cbeeebf751 100644 --- a/Doc/lib/libos.tex +++ b/Doc/lib/libos.tex @@ -826,6 +826,10 @@ the \ctype{stat} structure, namely: \member{st_ctime} (time of most recent content modification or metadata change). +\versionchanged [The time values are floats, measuring + seconds. Fractions of a second may be reported if the system + supports that]{2.3} + On some Unix systems (such as Linux), the following attributes may also be available: \member{st_blocks} (number of blocks allocated for file), @@ -856,12 +860,7 @@ order \member{st_atime}, \member{st_mtime}, \member{st_ctime}. -More items may be added at the end by some implementations. Note that -on the Mac OS, the time values are floating point values, like all -time values on the Mac OS. -\versionchanged -[On other systems, the values are floats if the system reports - fractions of a second]{2.3} +More items may be added at the end by some implementations. The standard module \refmodule{stat}\refstmodindex{stat} defines functions and constants that are useful for extracting information from a \ctype{stat} structure. diff --git a/Misc/NEWS b/Misc/NEWS index 4e0c319d2d0..e1e0104f0e2 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -274,8 +274,7 @@ Core and builtins Extension modules -- The time stamps in os.stat_result are floating point numbers now if - the system supports that. +- The time stamps in os.stat_result are floating point numbers now. - If the size passed to mmap.mmap() is larger than the length of the file on non-Windows platforms, a ValueError is raised. [SF bug 585792] diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 6124400148e..0c409aeabd5 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -616,15 +616,7 @@ static void fill_time(PyObject *v, int index, time_t sec, unsigned long nsec) { PyObject *val; - if (nsec) { - val = PyFloat_FromDouble(sec + 1e-9*nsec); - } else { -#if SIZEOF_TIME_T > SIZEOF_LONG - val = PyLong_FromLongLong((LONG_LONG)sec); -#else - val = PyInt_FromLong((long)sec); -#endif - } + val = PyFloat_FromDouble(sec + 1e-9*nsec); PyStructSequence_SET_ITEM(v, index, val); } diff --git a/configure b/configure index ecd0828c686..c23b45fa768 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 1.341 . +# From configure.in Revision: 1.342 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. # @@ -15738,7 +15738,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_stat_tv_nsec = yes + ac_cv_stat_tv_nsec=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 diff --git a/configure.in b/configure.in index 57924e885ca..037dc45c7a3 100644 --- a/configure.in +++ b/configure.in @@ -2247,7 +2247,7 @@ AC_TRY_COMPILE([#include ], [ struct stat st; st.st_mtim.tv_nsec = 1; ], -ac_cv_stat_tv_nsec = yes, +ac_cv_stat_tv_nsec=yes, ac_cv_stat_tv_nsec=no, ac_cv_stat_tv_nsec=no)) AC_MSG_RESULT($ac_cv_stat_tv_nsec)