[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 01:35:31 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:

```suggestion
template <class _Duration>
_LIBCPP_HIDE_FROM_ABI chrono::steady_clock::time_point __rel_to_abs(const _Duration& __rel_time) {
  return chrono::steady_clock::now() + chrono::ceil<chrono::steady_clock::duration>(__rel_time);
}

```
A few nits:
AFAIK: We don't need the `inline` specifier.
FYI: We like to stick to The Standard wording and I don't think that the `using` directive improves anything, see:
https://eel.is/c++draft/thread.condition#general-6
Also it looks like this causes an error, so please fully qualify.

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


More information about the libcxx-commits mailing list