Route QTimeZone::setSecondsAheadOfUtc() via setDurationAheadOfUtc()

... rather than the other way round. This ensures that the latter's
check for value-in-range is correctly handled.

Pick-to: 6.5
Task-number: QTBUG-109580
Change-Id: I21c2e7c1787c8f57e6893353e42261c013b648f6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Edward Welbourne 2023-02-06 12:20:50 +01:00
parent bf6cc9a4e2
commit ff7d5809f1

View File

@ -121,13 +121,14 @@ public:
static QTimeZone fromDurationAheadOfUtc(std::chrono::seconds offset)
{
return fromSecondsAheadOfUtc(int(offset.count()));
return QTimeZone((offset.count() >= MinUtcOffsetSecs && offset.count() <= MaxUtcOffsetSecs)
? ShortData(offset.count() ? Qt::OffsetFromUTC : Qt::UTC,
int(offset.count()))
: ShortData(Qt::TimeZone));
}
static QTimeZone fromSecondsAheadOfUtc(int offset)
{
return QTimeZone((offset >= MinUtcOffsetSecs && offset <= MaxUtcOffsetSecs)
? ShortData(offset ? Qt::OffsetFromUTC : Qt::UTC, offset)
: ShortData(Qt::TimeZone));
return fromDurationAheadOfUtc(std::chrono::seconds{offset});;
}
constexpr Qt::TimeSpec timeSpec() const noexcept { return d.s.spec(); }
constexpr int fixedSecondsAheadOfUtc() const noexcept