diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index dc4cc141530..71c01f94997 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,7 @@ +2018-08-01 Mike Crowe + + * include/std/condition_variable (wait_for): Use steady_clock. + 2018-08-01 Mike Crowe * include/std/condition_variable (wait_until): Only report timeout diff --git a/libstdc++-v3/include/std/condition_variable b/libstdc++-v3/include/std/condition_variable index c00afa2b7ae..1f84ea324eb 100644 --- a/libstdc++-v3/include/std/condition_variable +++ b/libstdc++-v3/include/std/condition_variable @@ -66,6 +66,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class condition_variable { typedef chrono::system_clock __clock_t; + typedef chrono::steady_clock __steady_clock_t; typedef __gthread_cond_t __native_type; #ifdef __GTHREAD_COND_INIT @@ -144,11 +145,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION wait_for(unique_lock& __lock, const chrono::duration<_Rep, _Period>& __rtime) { - using __dur = typename __clock_t::duration; + using __dur = typename __steady_clock_t::duration; auto __reltime = chrono::duration_cast<__dur>(__rtime); if (__reltime < __rtime) ++__reltime; - return wait_until(__lock, __clock_t::now() + __reltime); + return wait_until(__lock, __steady_clock_t::now() + __reltime); } template