[PATCH] D27429: [Chrono][Darwin] On Darwin use CLOCK_UPTIME_RAW instead of CLOCK_MONOTONIC

Eric Fiselier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 7 21:47:24 PST 2016


EricWF added a comment.

I'm not sure `CLOCK_UPTIME_RAW` meets the requirements of `steady_clock`. The manpage for `clock_gettime` on OS X specifies `CLOCK_UPTIME_RAW`  as:

> 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.

And C++17 [time.clock.steady]p1 says:

> Objects of class steady_clock represent clocks for which values of time_point never decrease as physical time advances and for which values of time_point advance at a steady rate relative to real time. That is, the clock may not be adjusted.

So if `CLOCK_UPTIME_RAW` doesn't update while the system is asleep does it advance at a steady rate relative to real time? I'm not convinced it does.

@mclow.lists Do you agree with this interpretation?


https://reviews.llvm.org/D27429





More information about the cfe-commits mailing list