[libcxx-commits] [libcxx] [libc++] Clarify clock behavior before epoch (LWG 3318) (PR #144697)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jun 18 18:19:42 PDT 2025
================
@@ -420,6 +430,8 @@ template<class charT, class traits, class Duration> // C++20
basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>& os, const file_time<Duration>& tp);
+/// The class steady_clock is monotonic and it does not support negative time points.
+/// Wheter it supports time before its epoch is unspecified.
----------------
frederick-vs-ja wrote:
I believe we need to update https://github.com/llvm/llvm-project/blob/main/libcxx/docs/Status/Cxx20Issues.csv.
libc++'s `duration::rep` is `nanoseconds` so I _think_ it can represent negative time points. According to the list in [LWG3318](https://cplusplus.github.io/LWG/issue3318), I think we don't need to mention signedness except for `steady_clock` and `high_resolution_clock`.
Also, it's also possibly redundant for `steady_clock` and `high_resolution_clock`. The standard says that the `rep` types are unspecified, and users can check the signedness by `rep::min() < rep::zero()`. Note that libc++ is already saying `nanoseconds` is the `duration` type of `steady_clock` in the comments.
https://github.com/llvm/llvm-project/pull/144697
More information about the libcxx-commits
mailing list