q20chrono: Fix feature test macro check

While the comment behind the else already had the correct value, the
actual check and the comment behind the endif had the wrong one. This
would cause build /headers clean check failures when using older
compilers in C++20/2a mode.
Also, remove the check for __cplusplus: A sufficiently high enough value
of __cpp_lib_chrono already implies __cplusplus > 201703L; the only
thing the check did was to hide the issue on more modern compilers.

Fixes compilation with e.g. gcc 9.3.
Amends bde5eeecaf

Change-Id: I74e761d9dc4048e9abf9cea9ea7e63260ea1111e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
This commit is contained in:
Fabian Kosmale 2023-05-16 09:03:15 +02:00
parent 8e94af2ed0
commit 3cee2f1950

View File

@ -38,7 +38,7 @@ using IntRep = int64_t;
using IntRep = int;
#endif
#if __cpp_lib_chrono >= 201611L && __cplusplus > 201703L
#if __cpp_lib_chrono >= 201907L
using std::chrono::days;
using std::chrono::weeks;
using std::chrono::years;
@ -53,7 +53,7 @@ using days = std::chrono::duration<IntRep, std::ratio<86400>>;
using weeks = std::chrono::duration<IntRep, std::ratio_multiply<std::ratio<7>, days::period>>;
using years = std::chrono::duration<IntRep, std::ratio_multiply<std::ratio<146097, 400>, days::period>>;
using months = std::chrono::duration<IntRep, std::ratio_divide<years::period, std::ratio<12>>>;
#endif // __cpp_lib_chrono >= 201611L
#endif // __cpp_lib_chrono >= 201907L
} // namespace chrono
} // namespace q20