diff --git a/src/core/tools/qdatetime.cpp b/src/core/tools/qdatetime.cpp index 832f789b4..99adb8336 100644 --- a/src/core/tools/qdatetime.cpp +++ b/src/core/tools/qdatetime.cpp @@ -2120,8 +2120,7 @@ void QDateTime::setDate(const QDate &date) { detach(); d->date = date; - if (d->spec == QDateTimePrivate::LocalStandard - || d->spec == QDateTimePrivate::LocalDST) + if (d->spec == QDateTimePrivate::LocalStandard) d->spec = QDateTimePrivate::LocalUnknown; if (date.isValid() && !d->time.isValid()) d->time = QTime(0, 0, 0); @@ -2136,8 +2135,7 @@ void QDateTime::setDate(const QDate &date) void QDateTime::setTime(const QTime &time) { detach(); - if (d->spec == QDateTimePrivate::LocalStandard - || d->spec == QDateTimePrivate::LocalDST) + if (d->spec == QDateTimePrivate::LocalStandard) d->spec = QDateTimePrivate::LocalUnknown; d->time = time; } @@ -2830,9 +2828,8 @@ QDateTime QDateTime::currentDateTime() dt.d->time.mds = msecsFromDecomposed(t->tm_hour, t->tm_min, t->tm_sec, tv.tv_usec / 1000); dt.d->date.jd = julianDayFromDate(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday); - dt.d->spec = t->tm_isdst > 0 ? QDateTimePrivate::LocalDST : - t->tm_isdst == 0 ? QDateTimePrivate::LocalStandard : - QDateTimePrivate::LocalUnknown; + dt.d->spec = (t->tm_isdst >= 0 ? QDateTimePrivate::LocalStandard : + QDateTimePrivate::LocalUnknown); return dt; } @@ -3494,9 +3491,7 @@ static QDateTimePrivate::Spec utcToLocal(QDate &date, QTime &time) date = QDate(brokenDown->tm_year + 1900, brokenDown->tm_mon + 1, brokenDown->tm_mday); time = QTime(brokenDown->tm_hour, brokenDown->tm_min, brokenDown->tm_sec, time.msec()); date = date.addDays(deltaDays); - if (brokenDown->tm_isdst > 0) - return QDateTimePrivate::LocalDST; - else if (brokenDown->tm_isdst < 0) + if (brokenDown->tm_isdst < 0) return QDateTimePrivate::LocalUnknown; else return QDateTimePrivate::LocalStandard; diff --git a/src/core/tools/qdatetime_p.h b/src/core/tools/qdatetime_p.h index 141e422b0..9830bf252 100644 --- a/src/core/tools/qdatetime_p.h +++ b/src/core/tools/qdatetime_p.h @@ -67,7 +67,7 @@ QT_BEGIN_NAMESPACE class QDateTimePrivate { public: - enum Spec { LocalUnknown = -1, LocalStandard = 0, LocalDST = 1, UTC = 2, OffsetFromUTC = 3}; + enum Spec { LocalUnknown = -1, LocalStandard = 0, UTC = 1, OffsetFromUTC = 2 }; QDateTimePrivate() : spec(LocalUnknown), utcOffset(0) {} QDateTimePrivate(const QDateTimePrivate &other)