[New-bugs-announce] [issue22287] Use clock_gettime() in pytime.c

STINNER Victor report at bugs.python.org
Wed Aug 27 12:51:55 CEST 2014

New submission from STINNER Victor:

On UNIX, time.time() currently uses clock_gettime(), but _PyTime_gettimeofday() doesn't becauce pytime.c lacks a dependency on the librt module (needed on some platforms).

Attached patch adds the dependency if needed and modify _PyTime_gettimeofday() to use clock_gettime() if available.

The patch alone is not very useful. I wrote it to prepare the work for the issue #22043 (use a monotonic clock in Python modules written in C).

With the patch, Python depends on the librt on Solaris and on Linux with glibc older than 2.17 (clock_gettime is now available directly in the libc since glibc 2.17).

files: clock_gettime.patch
keywords: patch
messages: 225967
nosy: haypo, loewis, neologix
priority: normal
severity: normal
status: open
title: Use clock_gettime() in pytime.c
versions: Python 3.5
Added file: http://bugs.python.org/file36485/clock_gettime.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list