[libcxx-commits] [PATCH] D143140: [libc++] avoid a GCC -Wsigned-compare warning where time_t is unsigned
Mark de Wever via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Feb 2 10:11:54 PST 2023
Mordante added a comment.
Thanks for your patch! One suggestion.
================
Comment at: libcxx/src/condition_variable.cpp:66
_LIBCPP_CONSTEXPR ts_sec ts_sec_max = numeric_limits<ts_sec>::max();
- if (s.count() < ts_sec_max)
- {
- ts.tv_sec = static_cast<ts_sec>(s.count());
- ts.tv_nsec = static_cast<decltype(ts.tv_nsec)>((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<ts_sec>(s.count());
----------------
This is consistent with the next line.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143140/new/
https://reviews.llvm.org/D143140
More information about the libcxx-commits
mailing list