QDateTime: Fix sign handling in the timezone offset writer

Previously, this produced wrong results, for example -3:30
became -3:-30.

Change-Id: I10efdfb48e5542b917c86b29cf8a99bfc26f7fe0
Reviewed-by: John Layt <jlayt@kde.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Daniel Seither 2014-02-04 12:39:17 +01:00 committed by The Qt Project
parent baf5eed1ef
commit ac109e1316

View File

@ -253,7 +253,7 @@ static QString toOffsetString(Qt::DateFormat format, int offset)
return result.arg(offset >= 0 ? QLatin1Char('+') : QLatin1Char('-')) return result.arg(offset >= 0 ? QLatin1Char('+') : QLatin1Char('-'))
.arg(qAbs(offset) / SECS_PER_HOUR, 2, 10, QLatin1Char('0')) .arg(qAbs(offset) / SECS_PER_HOUR, 2, 10, QLatin1Char('0'))
.arg((offset / 60) % 60, 2, 10, QLatin1Char('0')); .arg((qAbs(offset) / 60) % 60, 2, 10, QLatin1Char('0'));
} }
// Parse offset in [+-]HH[:]MM format // Parse offset in [+-]HH[:]MM format