diff options
Diffstat (limited to 'src/corelib/tools/qtimezone.cpp')
-rw-r--r-- | src/corelib/tools/qtimezone.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/corelib/tools/qtimezone.cpp b/src/corelib/tools/qtimezone.cpp index 567c819813..65c304bcf7 100644 --- a/src/corelib/tools/qtimezone.cpp +++ b/src/corelib/tools/qtimezone.cpp @@ -225,6 +225,20 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz); */ /*! + \enum QTimeZone::anonymous + + Sane UTC offsets range from -14 to +14 hours. + No known zone > 12 hrs West of Greenwich (Baker Island, USA). + No known zone > 14 hrs East of Greenwich (Kiritimati, Christmas Island, Kiribati). + + \value MinUtcOffsetSecs + -14 * 3600, + + \value MaxUtcOffsetSecs + +14 * 3600 +*/ + +/*! \enum QTimeZone::TimeType The type of time zone time, for example when requesting the name. In time @@ -338,12 +352,9 @@ QTimeZone::QTimeZone(const QByteArray &ianaId) */ QTimeZone::QTimeZone(int offsetSeconds) + : d((offsetSeconds >= MinUtcOffsetSecs && offsetSeconds <= MaxUtcOffsetSecs) + ? new QUtcTimeZonePrivate(offsetSeconds) : nullptr) { - // offsetSeconds must fall between -14:00 and +14:00 hours - if (offsetSeconds >= -50400 && offsetSeconds <= 50400) - d = new QUtcTimeZonePrivate(offsetSeconds); - else - d = 0; } /*! |