diff --git a/libcxx/src/condition_variable.cpp b/libcxx/src/condition_variable.cpp --- a/libcxx/src/condition_variable.cpp +++ b/libcxx/src/condition_variable.cpp @@ -63,15 +63,12 @@ seconds s = duration_cast(d); typedef decltype(ts.tv_sec) ts_sec; _LIBCPP_CONSTEXPR ts_sec ts_sec_max = numeric_limits::max(); - if (s.count() < ts_sec_max) - { - ts.tv_sec = static_cast(s.count()); - ts.tv_nsec = static_cast((d - s).count()); - } - else - { - ts.tv_sec = ts_sec_max; - ts.tv_nsec = giga::num - 1; + if ((unsigned long long)s.count() < ts_sec_max) { + ts.tv_sec = static_cast(s.count()); + ts.tv_nsec = static_cast((d - s).count()); + } else { + ts.tv_sec = ts_sec_max; + ts.tv_nsec = giga::num - 1; } int ec = __libcpp_condvar_timedwait(&__cv_, lk.mutex()->native_handle(), &ts); if (ec != 0 && ec != ETIMEDOUT)