Fix regression in time zone handling
In QtScript we use the msecs since epoch conversion (JS date is based on
the concept). After a8c74ddcf7
the date
conversion test in qtscript started to fail. Instead of relying on the
code working by chance, simply update the date when setting it with
setMSecsSinceEpoch.
Task-number: QTBUG-44885
Change-Id: I9f95c9cdccea52e7d1f808f3cb9e18570ef0df13
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
a29b7635bd
commit
3dbb526329
@ -3436,6 +3436,7 @@ void QDateTime::setMSecsSinceEpoch(qint64 msecs)
|
|||||||
epochMSecsToLocalTime(msecs, &dt, &tm, &status);
|
epochMSecsToLocalTime(msecs, &dt, &tm, &status);
|
||||||
d->setDateTime(dt, tm);
|
d->setDateTime(dt, tm);
|
||||||
d->setDaylightStatus(status);
|
d->setDaylightStatus(status);
|
||||||
|
d->refreshDateTime();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2634,10 +2634,6 @@ void tst_QDateTime::daylightTransitions() const
|
|||||||
QVERIFY(test.isValid());
|
QVERIFY(test.isValid());
|
||||||
QCOMPARE(test.date(), QDate(2012, 10, 28));
|
QCOMPARE(test.date(), QDate(2012, 10, 28));
|
||||||
QCOMPARE(test.time(), QTime(2, 0, 0));
|
QCOMPARE(test.time(), QTime(2, 0, 0));
|
||||||
#if !defined(Q_OS_MAC) && !defined(Q_OS_QNX)
|
|
||||||
// Linux mktime bug uses last calculation
|
|
||||||
QEXPECT_FAIL("", "QDateTime doesn't properly support Daylight Transitions", Continue);
|
|
||||||
#endif // Q_OS_MAC
|
|
||||||
QCOMPARE(test.toMSecsSinceEpoch(), standard2012 - msecsOneHour);
|
QCOMPARE(test.toMSecsSinceEpoch(), standard2012 - msecsOneHour);
|
||||||
|
|
||||||
// Add year to get to after tran FirstOccurrence
|
// Add year to get to after tran FirstOccurrence
|
||||||
@ -2676,10 +2672,6 @@ void tst_QDateTime::daylightTransitions() const
|
|||||||
QVERIFY(test.isValid());
|
QVERIFY(test.isValid());
|
||||||
QCOMPARE(test.date(), QDate(2012, 10, 28));
|
QCOMPARE(test.date(), QDate(2012, 10, 28));
|
||||||
QCOMPARE(test.time(), QTime(2, 0, 0));
|
QCOMPARE(test.time(), QTime(2, 0, 0));
|
||||||
#if !defined(Q_OS_MAC) && !defined(Q_OS_QNX)
|
|
||||||
// Linux mktime bug uses last calculation
|
|
||||||
QEXPECT_FAIL("", "QDateTime doesn't properly support Daylight Transitions", Continue);
|
|
||||||
#endif // Q_OS_MAC
|
|
||||||
QCOMPARE(test.toMSecsSinceEpoch(), standard2012 - msecsOneHour);
|
QCOMPARE(test.toMSecsSinceEpoch(), standard2012 - msecsOneHour);
|
||||||
|
|
||||||
// Add month to get to after tran FirstOccurrence
|
// Add month to get to after tran FirstOccurrence
|
||||||
@ -2718,10 +2710,6 @@ void tst_QDateTime::daylightTransitions() const
|
|||||||
QVERIFY(test.isValid());
|
QVERIFY(test.isValid());
|
||||||
QCOMPARE(test.date(), QDate(2012, 10, 28));
|
QCOMPARE(test.date(), QDate(2012, 10, 28));
|
||||||
QCOMPARE(test.time(), QTime(2, 0, 0));
|
QCOMPARE(test.time(), QTime(2, 0, 0));
|
||||||
#if !defined(Q_OS_MAC) && !defined(Q_OS_QNX)
|
|
||||||
// Linux mktime bug uses last calculation
|
|
||||||
QEXPECT_FAIL("", "QDateTime doesn't properly support Daylight Transitions", Continue);
|
|
||||||
#endif // Q_OS_MAC
|
|
||||||
QCOMPARE(test.toMSecsSinceEpoch(), standard2012 - msecsOneHour);
|
QCOMPARE(test.toMSecsSinceEpoch(), standard2012 - msecsOneHour);
|
||||||
|
|
||||||
// Add day to get to after tran FirstOccurrence
|
// Add day to get to after tran FirstOccurrence
|
||||||
|
Loading…
Reference in New Issue
Block a user