QTimer: fix calculation error in API docs

The range guaranteed by std¹ for nanosecond resolution is ±292 years,
not ±292 million.

¹ https://eel.is/c++draft/time.syn,
  https://en.cppreference.com/w/cpp/chrono/duration#Helper_types,
  std::cout << chrono::floor<years>(nanoseconds::max()) << '\n';

Since, in general, there is no integer type with ≥ 45 bits, but < 64
bits, the practical limit for milliseconds remains, indeed, ±292
million, so the QDateTime docs don't need fixing.

Change-Id: I5ae7f9706f147c6f490ba17b10cebe96426bbba2
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 051488c5faf5410e938978d4c1609c7a85074c57)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Ahmad Samir 2024-09-02 22:42:10 +03:00 committed by Qt Cherry-pick Bot
parent 400426c388
commit 0773176fc2

View File

@ -78,7 +78,7 @@ QT_BEGIN_NAMESPACE
The maximum interval QTimer supports is limited by the number of The maximum interval QTimer supports is limited by the number of
milliseconds that would fit in an \c int (which is around 24 days); milliseconds that would fit in an \c int (which is around 24 days);
whereas QChronoTimer stores its interval as \c std::chrono::nanoseconds whereas QChronoTimer stores its interval as \c std::chrono::nanoseconds
(which raises that limit to around 292 million years), that is, there is (which raises that limit to ±292 years), that is, there is
less chance of integer overflow with QChronoTimer. less chance of integer overflow with QChronoTimer.
\section1 Accuracy and Timer Resolution \section1 Accuracy and Timer Resolution