[pypy-issue] [issue1640] Posix 2001 ftime() is deprecated

Tobias Oberstein tracker at bugs.pypy.org
Sun Nov 17 19:24:03 CET 2013


New submission from Tobias Oberstein <tobias.oberstein at gmail.com>:

The ftime() function which is declared in <sys/timeb.h> which is only included
in rpython/rtyper/module/ll_time.py is deprecated:

http://linux.die.net/man/3/ftime

The inclusion of the respective header produces lots of warnings on
FreeBSD/Clang and clutters the log.

The Linux man page suggests:

"This function is obsolete. Don't use it. If the time in seconds suffices,
time(2) can be used; gettimeofday(2) gives microseconds; clock_gettime(2) gives
nanoseconds but is not as widely available."

clock_gettime is available on both Linux and FreeBSD and provides
best-resolution time:

http://linux.die.net/man/2/clock_gettime
http://www.freebsd.org/cgi/man.cgi?query=clock_gettime
http://stackoverflow.com/questions/275004/c-timer-function-to-provide-time-in-nano-seconds/275231#275231

However, it's not there on OSX:

http://stackoverflow.com/questions/5167269/clock-gettime-alternative-in-mac-os-x

So we could adjust ll_time.py to use clock_gettime() instead of ftime() on
Linux/FreeBSD and do a workaround for OSX. Not sure if that would be acceptable ..

----------
messages: 6350
nosy: oberstet, pypy-issue
priority: bug
status: unread
title: Posix 2001 ftime() is deprecated

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1640>
________________________________________


More information about the pypy-issue mailing list