summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qtimezoneprivate_tz.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-08-06 10:45:40 +0200
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-08-06 10:54:01 +0200
commit77da617dc8e378a631ee8c15b1b414f16b87f147 (patch)
tree563f4f8e64e416774ea2b1599b896b589385168c /src/corelib/tools/qtimezoneprivate_tz.cpp
parentc17134e2db4d364855aa78a0d3c47cb9ef964dd9 (diff)
parent01f3530650f9f6f4c08520263a3c62281d81e3fc (diff)
Merge remote-tracking branch 'origin/5.5' into dev
Conflicts: doc/global/qt-cpp-defines.qdocconf src/3rdparty/forkfd/forkfd.c src/corelib/codecs/qtextcodec.cpp src/corelib/kernel/qmetatype.cpp src/corelib/tools/qset.qdoc src/gui/accessible/qaccessible.cpp src/gui/image/qpixmapcache.cpp src/opengl/qgl.cpp src/tools/qdoc/generator.cpp src/widgets/kernel/qwidget.cpp tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp Change-Id: I4fbe1fa756a54c6843aa75f4ef70a1069ba7b085
Diffstat (limited to 'src/corelib/tools/qtimezoneprivate_tz.cpp')
-rw-r--r--src/corelib/tools/qtimezoneprivate_tz.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp
index 7c5e5bd2cf..90ce8e3b68 100644
--- a/src/corelib/tools/qtimezoneprivate_tz.cpp
+++ b/src/corelib/tools/qtimezoneprivate_tz.cpp
@@ -389,12 +389,19 @@ static int parsePosixOffset(const QByteArray &timeRule)
// Format "[+|-]hh[:mm[:ss]]"
QList<QByteArray> parts = timeRule.split(':');
int count = parts.count();
- if (count == 3)
- return (parts.at(0).toInt() * -60 * 60) + (parts.at(1).toInt() * 60) + parts.at(2).toInt();
- else if (count == 2)
- return (parts.at(0).toInt() * -60 * 60) + (parts.at(1).toInt() * 60);
- else if (count == 1)
- return (parts.at(0).toInt() * -60 * 60);
+ if (count == 3) {
+ int hour = parts.at(0).toInt();
+ int sign = hour >= 0 ? -1 : 1;
+ return sign * ((qAbs(hour) * 60 * 60) + (parts.at(1).toInt() * 60) + parts.at(2).toInt());
+ } else if (count == 2) {
+ int hour = parts.at(0).toInt();
+ int sign = hour >= 0 ? -1 : 1;
+ return sign * ((qAbs(hour) * 60 * 60) + (parts.at(1).toInt() * 60));
+ } else if (count == 1) {
+ int hour = parts.at(0).toInt();
+ int sign = hour >= 0 ? -1 : 1;
+ return sign * (qAbs(hour) * 60 * 60);
+ }
return 0;
}