llvm-project/libcxx/test/std/utilities
Martin Storsjö 02f1d28ed6 [libcxx] Avoid overflows in the windows __libcpp_steady_clock_now()
As freq.QuadValue can be in the range of 10000000 to 19200000,
the multiplication before division makes the calculation overflow
and wrap to negative values every 16-30 minutes.

Instead count the whole seconds separately before adding the
scaled fractional seconds.

Add a testcase for steady_clock to check that the values returned for
now() compare as bigger than the zero time origin; this
corresponds to a testcase in Qt [1] [2] (that failed spuriously
due to this).

[1] https://bugreports.qt.io/browse/QTBUG-89539
[2] https://code.qt.io/cgit/qt/qtbase.git/tree/tests/auto/corelib/kernel/qdeadlinetimer/tst_qdeadlinetimer.cpp?id=f8de5e54022b8b7471131b7ad55c83b69b2684c0#n569

Differential Revision: https://reviews.llvm.org/D93456
2021-01-12 23:56:03 +02:00
..
allocator.adaptor [libc++] Remove the c++98 Lit feature from the test suite 2020-06-03 09:37:22 -04:00
any [libc++] Rename the -fno-rtti Lit feature to just no-rtti 2020-09-29 16:29:44 -04:00
charconv [libc++] Remove the c++98 Lit feature from the test suite 2020-06-03 09:37:22 -04:00
function.objects [libc++] Fix a test failure in 7b00e9fae3 (D93815). 2020-12-28 18:46:07 -05:00
intseq [libc++] NFCI: Use Lit features to disable tests instead of #if 2020-10-16 08:35:34 -04:00
memory [libc++] LWG2070: Use Allocator construction for objects created with allocate_shared 2021-01-08 13:04:03 -05:00
meta [libc++] [C++2b] [P1048] Add is_scoped_enum and is_scoped_enum_v. 2021-01-12 17:08:20 +01:00
optional Fix UB in one libcxx test, when deleting D through a pointer to B. 2020-11-04 17:34:05 -05:00
ratio [libc++] Remove workaround for .fail.cpp tests that don't have clang-verify markup 2020-04-15 10:53:37 -04:00
smartptr/unique.ptr [libc++] NFC: Fix several GCC warnings in the test suite 2020-10-30 12:48:05 -04:00
template.bitset [libc++] NFC: Fix several GCC warnings in the test suite 2020-10-30 12:48:05 -04:00
time [libcxx] Avoid overflows in the windows __libcpp_steady_clock_now() 2021-01-12 23:56:03 +02:00
tuple [libc++] Fix tests on GCC 10 2020-09-29 12:08:33 -04:00
type.index [libc++] Rename the -fno-rtti Lit feature to just no-rtti 2020-09-29 16:29:44 -04:00
utilities.general Support tests in freestanding 2019-02-04 20:31:13 +00:00
utility [libc++] NFC: Fix several GCC warnings in the test suite 2020-10-30 12:48:05 -04:00
utility.requirements [libc++] Remove useless nothing_to_do.pass.cpp tests 2020-04-03 13:48:34 -04:00
variant [libc++] ADL-proof <variant> by adding _VSTD:: qualification on calls. 2020-11-25 09:19:37 -05:00