STINNER Victor <victor.stin...@haypocalc.com> added the comment:

clock_gettime.patch: add time.clock_gettime() function and time.CLOCK_xxx 
constants. The patch requires to rerun "autoconf".

For the documentation, I don't know the availability of this function. Is it 
available on Windows? CLOCK_REALTIME doc contains "Setting this clock requires 
appropriate privileges": this sentence might be removed if we don't expose 
clock_settime.

The constants are not defined if the function is not available.

timemodule.c and datetimemodule.c are no more linked to libm. I don't know why 
libm was used? Copy/paste failure?

On Linux, clock_gettime() requires librt. I chose to check for librt in 
configure.in. To get this info in setup.py, I close to use the TIMEMODULE_LIBS 
define (in pyconfig.h). I don't know if there is something simpler.

time.clock_gettime() returns a float. It would be nice to keep nanoseconds as 
an integer, but I chose a float to mimic other time functions. If we need 
nanosecond resolution, a new function can be added.

The unit test is very simple, but less than time.clock() test :-)

----------
Added file: http://bugs.python.org/file23083/clock_gettime.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10278>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to