Issue 22624: Bogus usage of floatclock in timemodule - Python tracker

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.

classification
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: Link Mauve, python-dev, vstinner
Priority: normal Keywords:

Created on 2014-10-13 18:34 by Link Mauve, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
pyconfig.h Link Mauve, 2014-10-14 09:43
Messages (7)
msg229260 - (view) Author: (Link Mauve) Date: 2014-10-13 18:34
In Modules/timemodule.c, py_process_time() still uses floatclock() even when HAVE_CLOCK isn’t defined.
msg229280 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-10-14 08:38
What is your platform?

time.process_time() supports many functions:

 - GetProcessTimes() (Windows only)
 - clock_gettime(CLOCK_PROF)
 - clock_gettime(CLOCK_PROCESS_CPUTIME_ID)
 - getrusage(RUSAGE_SELF)
 - times()
 - clock()

On POSIX, clock() is always tried as a fallback. Does your platform support at least one of these functions?
msg229281 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-10-14 08:38
See also the PEP 418:
http://legacy.python.org/dev/peps/pep-0418/#time-process-time
msg229283 - (view) Author: (Link Mauve) Date: 2014-10-14 09:29
I’m building against the Newlib libc, for the Wii, and it seems the issue leading to all of those functions not working is:
(.text.clock+0x18): undefined reference to `_times_r'

Threading is disabled, and reentrant functions as well, which could explain that.

But still, when pyconfig.h doesn’t define any HAVE_ macro to get the system time, I would expect py_process_time() to return None or something instead of failing to build.
msg229284 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-10-14 09:42
Please attach your pyconfig.h file.
msg269990 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-07-08 15:23
Sorry but the Wii console is not supported. You have to maintain your fork/patch.

Python 3 don't support platforms without clock().
msg269993 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-07-08 15:55
New changeset 1452520dfe7b by Victor Stinner in branch 'default':
Issue #22624: Python 3 requires clock() to build
https://hg.python.org/cpython/rev/1452520dfe7b