From 35d0f012ee9b95e8cf3563a41d710ff3c023d841 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 25 Jul 2023 15:39:56 +0200 Subject: [PATCH] Refine minor details in Darwin time-zone backend It's Darwin, no longer OS X. Include a link to the URL of NSTimeZone's docs. Use actuall Q_UNREACHABLE() rather than a comment. Correct a TODO comment (there *is* API for it, but fiddly). Make a lower bound constexpr rather than merely const. Task-number: QTBUG-104012 Change-Id: I9bf2018fa27ac9f6aa38eaebbf6b0f90ff5f6188 Reviewed-by: Thiago Macieira --- src/corelib/time/qtimezoneprivate_mac.mm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/corelib/time/qtimezoneprivate_mac.mm b/src/corelib/time/qtimezoneprivate_mac.mm index b051b08ec7c..b7cfd2bb855 100644 --- a/src/corelib/time/qtimezoneprivate_mac.mm +++ b/src/corelib/time/qtimezoneprivate_mac.mm @@ -19,7 +19,8 @@ QT_BEGIN_NAMESPACE /* Private - OS X system implementation + Darwin system implementation + https://developer.apple.com/documentation/foundation/nstimezone */ // Create the system default time zone @@ -113,7 +114,7 @@ QString QMacTimeZonePrivate::displayName(QTimeZone::TimeType timeType, style = NSTimeZoneNameStyleStandard; break; case QTimeZone::OffsetName : - // Unreachable + Q_UNREACHABLE(); break; } @@ -149,7 +150,7 @@ int QMacTimeZonePrivate::daylightTimeOffset(qint64 atMSecsSinceEpoch) const bool QMacTimeZonePrivate::hasDaylightTime() const { - // TODO No Mac API, assume if has transitions + // TODO Scan transitions for one after which isDaylightSavingTimeForDate is true. return hasTransitions(); } @@ -204,7 +205,7 @@ QTimeZonePrivate::Data QMacTimeZonePrivate::nextTransition(qint64 afterMSecsSinc QTimeZonePrivate::Data QMacTimeZonePrivate::previousTransition(qint64 beforeMSecsSinceEpoch) const { // The native API only lets us search forward, so we need to find an early-enough start: - const NSTimeInterval lowerBound = std::numeric_limits::lowest(); + constexpr NSTimeInterval lowerBound = std::numeric_limits::lowest(); const qint64 endSecs = beforeMSecsSinceEpoch / 1000; const int year = 366 * 24 * 3600; // a (long) year, in seconds NSTimeInterval prevSecs = endSecs; // sentinel for later check