[pypy-issue] [issue1640] Posix 2001 ftime() is deprecated
Tobias Oberstein
tracker at bugs.pypy.org
Sun Nov 17 21:40:16 CET 2013
Tobias Oberstein <tobias.oberstein at gmail.com> added the comment:
CPython 2.7.6 tests for ftime() availability
https://gist.github.com/oberstet/7516529#file-gistfile1-txt-L327
and then only includes if HAVE_FTIME
http://hg.python.org/cpython/file/cc27c0aba18b/Modules/timemodule.c#l30
On above build log, ftime() is undetected - I'm not sure how that works, since
ftime() is still there on FreeBSD (as is the header sys/timeb.h), but it's
deprecated .. and Clang will produce a warning.
As far as I can see from the source here
http://hg.python.org/cpython/file/cc27c0aba18b/Modules/timemodule.c#l905
CPy will prefer gettimeofday to ftime, even if both are available. I find that C
style .. strange. They have 2 blocks of C, where the first returns, so the
second is unreachable code if both HAVE_GETTIMEOFDAY and HAVE_FTIME are defined.
Well.
In no case does CPy 2 use clock_gettime() - which is a pity.
It seems, this is only available in CPy 3 via
http://www.python.org/dev/peps/pep-0418/
So if PyPy is to model CPy 2, we might use gettimeofday() when avail, otherwise
fallback to ftime().
________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1640>
________________________________________
More information about the pypy-issue
mailing list