diff options
author | Martin Storsjö <martin@martin.st> | 2020-12-17 15:40:06 +0200 |
---|---|---|
committer | Tobias Hieta <tobias@plex.tv> | 2021-02-01 14:09:23 +0100 |
commit | 579d0dc25dcd72e0a0a1411426c921cf01bfefe3 (patch) | |
tree | df95402943372e7b0cb3954397f4433cee7b21d9 /llvm/examples/ModuleMaker/ModuleMaker.cpp | |
parent | dde4343cae5ecfa29b57c5af5043f3dfb3845ea1 (diff) | |
download | llvm-579d0dc25dcd72e0a0a1411426c921cf01bfefe3.tar.gz |
[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
Diffstat (limited to 'llvm/examples/ModuleMaker/ModuleMaker.cpp')
0 files changed, 0 insertions, 0 deletions