[issue40174] HAVE_CLOCK_GETTIME not repected in pytime.c

STINNER Victor report at bugs.python.org
Sat Apr 4 15:35:49 EDT 2020


STINNER Victor <vstinner at python.org> added the comment:

Python has a long history (30 years). time.time() had multiple implementations. When I added time.monotonic() in Python 3.3, it was optional. I changed that in Python 3.5: time.monotonic() is now always available.
https://docs.python.org/dev/library/time.html#time.monotonic

time.monotonic() has multiple implementations:

* Windows: GetTickCount64()
* macOS (Darwin): mach_absolute_time()
* HP-UX: gethrtime()
* Solaris: clock_gettime(CLOCK_HIGHRES)
* Otherwise: clock_gettime(CLOCK_MONOTONIC)

So far (since Python 3.5), no one complained about build error on any platform. It looks safe in practice to expect clock_gettime() to be available.

I suggest to close this issue, and only change the code is Python fails to build on a specific platform.

By the way, glibc 2.31 release notes: "We plan to remove the obsolete function ftime, and the header <sys/timeb.h>, in a future version of glibc."

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40174>
_______________________________________


More information about the Python-bugs-list mailing list