You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I do not believe KDDateTime handles time zones strings for fractional time zones correctly.
The code in question is:
setTimeSpec(Qt::OffsetFromUTC);
const int pos = timeZone.indexOf(QLatin1Char(':'));
if (pos > 0) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
const int hours = timeZone.leftRef(pos).toInt();
const int minutes = timeZone.midRef(pos + 1).toInt();
#else
const QStringView timeZoneView(timeZone);
const int hours = timeZoneView.first(pos).toInt();
const int minutes = timeZoneView.sliced(pos + 1).toInt();
#endif
const int offset = hours * 3600 + minutes * 60;
setOffsetFromUtc(offset);
}
Fractional time zones which is what this issue is about. There are only a few in use and even fewer which are a negative UTC offset. Looking at the example of Newfoundland, Canada which has an offset of -3:30/-2:30 depending on daylight savings and looking specifically at -3:30:
The hours extracted by the above code would be -3.
The minutes extracted by the above code would be + 30.
The line: const int offset = hours * 3600 + minutes * 60;
Would give an offset of -3 * 3600 or - 10800, plus 1800, giving an offset of -9000 seconds, or 2 1/2 hours instead of 3 1/2.
The text was updated successfully, but these errors were encountered:
I do not believe KDDateTime handles time zones strings for fractional time zones correctly.
The code in question is:
Fractional time zones which is what this issue is about. There are only a few in use and even fewer which are a negative UTC offset. Looking at the example of Newfoundland, Canada which has an offset of -3:30/-2:30 depending on daylight savings and looking specifically at -3:30:
The hours extracted by the above code would be -3.
The minutes extracted by the above code would be + 30.
The line:
const int offset = hours * 3600 + minutes * 60;
Would give an offset of -3 * 3600 or - 10800, plus 1800, giving an offset of -9000 seconds, or 2 1/2 hours instead of 3 1/2.
The text was updated successfully, but these errors were encountered: