summaryrefslogtreecommitdiffstats
path: root/src/corelib/time/qtimezoneprivate_icu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/time/qtimezoneprivate_icu.cpp')
-rw-r--r--src/corelib/time/qtimezoneprivate_icu.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/corelib/time/qtimezoneprivate_icu.cpp b/src/corelib/time/qtimezoneprivate_icu.cpp
index 798f231219..b1de236fcb 100644
--- a/src/corelib/time/qtimezoneprivate_icu.cpp
+++ b/src/corelib/time/qtimezoneprivate_icu.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 John Layt <jlayt@kde.org>
-** Copyright (C) 2021 The Qt Company Ltd.
+** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -207,6 +207,14 @@ static QTimeZonePrivate::Data ucalTimeZoneTransition(UCalendar *m_ucal,
status = U_ZERO_ERROR;
bool ok = ucal_getTimeZoneTransitionDate(ucal, type, &tranMSecs, &status);
+ // Catch a known violation (in ICU 67) of the specified behavior:
+ if (U_SUCCESS(status) && ok && type == UCAL_TZ_TRANSITION_NEXT) {
+ // At the end of time, that can "succeed" with tranMSecs ==
+ // atMSecsSinceEpoch, which should be treated as a failure.
+ // (At the start of time, previous correctly fails.)
+ ok = qint64(tranMSecs) > atMSecsSinceEpoch;
+ }
+
// Set the transition time to find the offsets for
if (U_SUCCESS(status) && ok) {
status = U_ZERO_ERROR;