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 <thiago.macieira@intel.com>
This commit is contained in:
parent
e73e972aa6
commit
35d0f012ee
@ -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<NSTimeInterval>::lowest();
|
||||
constexpr NSTimeInterval lowerBound = std::numeric_limits<NSTimeInterval>::lowest();
|
||||
const qint64 endSecs = beforeMSecsSinceEpoch / 1000;
|
||||
const int year = 366 * 24 * 3600; // a (long) year, in seconds
|
||||
NSTimeInterval prevSecs = endSecs; // sentinel for later check
|
||||
|
Loading…
x
Reference in New Issue
Block a user