diff options
| author | Ahmad Samir <a.samirh78@gmail.com> | 2024-09-02 22:42:10 +0300 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2024-09-03 14:42:24 +0000 |
| commit | 051488c5faf5410e938978d4c1609c7a85074c57 (patch) | |
| tree | 924ce9afe25aa010a02c7a629da001e297189f1e /src/corelib/kernel/qtimer.cpp | |
| parent | 2ef1a338a91659871675514921f9a7dc8d1c8805 (diff) | |
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.
Pick-to: 6.8
Change-Id: I5ae7f9706f147c6f490ba17b10cebe96426bbba2
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib/kernel/qtimer.cpp')
| -rw-r--r-- | src/corelib/kernel/qtimer.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp index 642e53ac4ef..328bcd0ee2f 100644 --- a/src/corelib/kernel/qtimer.cpp +++ b/src/corelib/kernel/qtimer.cpp @@ -78,7 +78,7 @@ QT_BEGIN_NAMESPACE The maximum interval QTimer supports is limited by the number of milliseconds that would fit in an \c int (which is around 24 days); 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. \section1 Accuracy and Timer Resolution |
