During std::condition_variable::wait_for(), we sample the system clock and then we sample the steady clock.
If a tick occurs after the system clock is sampled, but prior to when the steady clock is sampled, then the __do_timed_wait() may elapse the entire duration but the check at the end will fail and we'll return cv_status::no_timeout in error. In the thread.condition.condvar/wait_for test, this causes the test to fail for my hexagon target.
§ 30.5.1 states “Returns: cv_status::timeout if the relative timeout (30.2.4) specified by rel_time expired, otherwise cv_status::no_timeout.”
This proposed fix would sample the steady clock first. Now, if the tick elapses between the two the check would yield the same results as the underlying __do_timed_wait().