[PATCH] D27429: [Chrono][Darwin] On Darwin use CLOCK_UPTIME_RAW instead of CLOCK_MONOTONIC
Duncan P. N. Exon Smith via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 9 16:21:37 PST 2016
Two points to make here:
1. CLOCK_UPTIME_RAW exactly matches the previous behaviour, so even if it's wrong, it's not a regression. See the next sentence from the one Eric quoted:
CLOCK_UPTIME_RAW clock that increments monotonically, in the same manner as
CLOCK_MONOTONIC_RAW, but that does not increment while the
system is asleep. The returned value is identical to the
result of mach_absolute_time() after the appropriate
mach_timebase conversion is applied.
The previous implementation used mach_absolute_time() with "the appropriate mach_timebase conversion". Using CLOCK_UPTIME_RAW is maintaining the status quo.
Moreover, libc++ is currently incorrectly/accidentally/incidentally using CLOCK_MONOTONIC, which has frequency and time adjustments, and is definitely un-steady. I think this patch should be committed promptly to maintain the status quo and match what's shipping (and has shipped for 5 years) on Darwin.
Then we can argue about whether to change how steady_clock works going forward (maybe we should).
2. I find your argument unconvincing. Why must the clock continue to increment when the system is asleep? The text only says that it advances relative to real time, not that it advances when the system isn't running.
> On 2016-Dec-09, at 09:15, Eric Fiselier via Phabricator <reviews at reviews.llvm.org> wrote:
>
> EricWF added a comment.
>
> `CLOCK_MONOTONIC_RAW` however seems to meet the requirements..
>
>
> https://reviews.llvm.org/D27429
>
>
>
More information about the cfe-commits
mailing list