[issue41303] perf_counter result does not count system sleep time in Mac OS

Ronald Oussoren report at bugs.python.org
Wed Aug 5 11:08:09 EDT 2020


Ronald Oussoren <ronaldoussoren at mac.com> added the comment:

@Nathaniel: I hadn't noticed that CLOCK_MONOTONIC on macOS behaves different from that clock on Linux. Sigh.

That means there's little reason to switch to CLOCK_MONOTONIC on macOS, that would just result in different behaviour between Linux and macOS. 

There is a clock with similar behaviour as the Linux clock: CLOCK_UPTIME_RAW, but switching to that instead of mach_absolute_time would just complicate the code base because we still support macOS 10.9 where clock_gettime is not available.

BTW. I'm against using mach_continuous_time, if a change is needed it should be to clock_gettime as that's the more portable API.   And given the stated goal of time.perf_counter() a change is IMHO not necessary.

----------

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


More information about the Python-bugs-list mailing list