[libcxx-commits] [libcxx] [libc++][chrono][threading] Implement LWG 3504: `condition_variable::wait_for` is overspecified (PR #222443)

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 10 05:45:20 PDT 2026


================
@@ -40,6 +40,12 @@ _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
 _LIBCPP_DECLARE_STRONG_ENUM(cv_status){no_timeout, timeout};
 _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(cv_status)
 
+template <class _Duration>
+inline _LIBCPP_HIDE_FROM_ABI chrono::steady_clock::time_point __rel_to_abs(const _Duration& __rel_time) {
+  using namespace chrono;
+  return steady_clock::now() + ceil<steady_clock::duration>(__rel_time);
+}
+
----------------
Zingam wrote:

The specify more precisely: we want a private internal version of 
```c++
 _ToDuration __ceil(const duration<_Rep, _Period>& __d) {
  _ToDuration __t = chrono::duration_cast<_ToDuration>(__d);
  if (__t < __d)
    __t = __t + _ToDuration{1};
  return __t;
}

...
#if _LIBCPP_STD_VER >= 17
 _ToDuration ceil(const duration<_Rep, _Period>& __d) {
  return chrono::__ceil(...);
}
...
 ```
 , which will be used in chrono::ceil and be available in older modes. Is the name `__ceil` OK?

https://github.com/llvm/llvm-project/pull/222443


More information about the libcxx-commits mailing list