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.

Author nooB
Recipients ned.deily, nooB, ronaldoussoren
Date 2020-07-15.12:43:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1594816999.52.0.200760723432.issue41303@roundup.psfhosted.org>
In-reply-to
Content
Documentation for time.perf_counter says "does include time elapsed during sleep".

https://docs.python.org/3.8/library/time.html#time.perf_counter

But it does not work as expected in Mac OS. I learnt that perf_counter uses the underlying c function: "mach_absolute_time".

-------------------------

import time
time.get_clock_info('perf_counter')
namespace(adjustable=False, implementation='mach_absolute_time()', monotonic=True, resolution=1e-09)

-------------------------

The documentation for "mach_absolute_time" clearly states that "this clock does not increment while the system is asleep"

https://developer.apple.com/documentation/kernel/1462446-mach_absolute_time


FWIW, Mac kernel does offer another function which returns monotonic ticks "including while the system is asleep"

https://developer.apple.com/documentation/kernel/1646199-mach_continuous_time

But it seems to be available only on Mac 10.12+.
History
Date User Action Args
2020-07-15 12:43:19nooBsetrecipients: + nooB, ronaldoussoren, ned.deily
2020-07-15 12:43:19nooBsetmessageid: <1594816999.52.0.200760723432.issue41303@roundup.psfhosted.org>
2020-07-15 12:43:19nooBlinkissue41303 messages
2020-07-15 12:43:19nooBcreate