[WIP] bpo-36205: incorrect time.process_time when built on macOS < 10.12 #12287
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
bpo-36205 documents a problem where
time.process_timeandtime.perf_counterreturn very different values when built on macOS 10.11 or earlier. Several time related functions were added to macOS at 10.12 includingclock_gettime. For older systems, timemodule.c falls back to usinggetrusage. With Python 3.6.x, that fallbacks correctly but it appears that refactoring introduced with the implementation of PEP 564 (bpo-31784, #3989) broke that for 3.7.z.This initial PR just includes a potential test case to ensure process_time and perf_counter return similar results. It can be used to reproduce the problem when building on newer versions of macOS (10.12+) by removing the
AC_CHECK_FUNCS(clock_gettime)test inconfigure.ac:and running the test in this PR:
https://bugs.python.org/issue36205