New submission from Seth Junot <xset...@gmail.com>:

This blog post describes an issue with Apple's "CLOCK_UPTIME_RAW" where the 
clock is reset after a system that hibernates:

https://rachelbythebay.com/w/2020/10/20/ticktock/

According to Apple's documentation, CLOCK_UPTIME_RAW corresponds to 
mach_absolute_time():

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

CPython is using mach_absolute_time() for its time.monotonic() implementation:

https://github.com/python/cpython/blob/f660567/Python/pytime.c#L7

time.monotonic() ought to be backed by the more appropriate 
mach_continuous_time() ("CLOCK_MONOTONIC_RAW"). Note it was introduced in macOS 
10.12+:

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

----------
components: macOS
messages: 379204
nosy: ned.deily, ronaldoussoren, sjunot
priority: normal
severity: normal
status: open
title: Monotonic time on macOS 10.12+ should use mach_continuous_time()
type: behavior
versions: Python 3.10

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42107>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to