This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients anacrolix, belopolsky, brian.curtin, eric.araujo, glenn, kristjan.jonsson, michael.foord, pitrou, vstinner
Date 2011-09-02.00:25:54
SpamBayes Score 7.231277e-06
Marked as misclassified No
Message-id <1314923160.98.0.215533597973.issue10278@psf.upfronthosting.co.za>
In-reply-to
Content
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 :-)
History
Date User Action Args
2011-09-02 00:26:01vstinnersetrecipients: + vstinner, belopolsky, pitrou, kristjan.jonsson, eric.araujo, michael.foord, brian.curtin, glenn, anacrolix
2011-09-02 00:26:00vstinnersetmessageid: <1314923160.98.0.215533597973.issue10278@psf.upfronthosting.co.za>
2011-09-02 00:26:00vstinnerlinkissue10278 messages
2011-09-02 00:25:59vstinnercreate