diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2022-08-30 16:07:50 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2022-12-10 06:39:44 +0100 |
commit | 2f440169c07e9501bad6f668c66961d49532eacc (patch) | |
tree | 49cadd223a19487e08391572c046638287235b0b /tests/auto/testlib | |
parent | 8c8d6ff7b6e2e6b1b673051685f1499ae4d65e05 (diff) |
Adapt to QTimeZone replacing Qt::TimeSpec usage
In the process actually handle all time-spec cases in various places
that only handled UTC or LocalTime, or at least note that they don't
where that's not practical. Also tidy up header ordering and ensure
QDateTime's header is included wherever it's used, while adding the
include for QTimeZone where needed.
Task-number: QTBUG-108199
Change-Id: Ic1a5cdf0aaf737bf1396aa8ac58ce2004cef7e19
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'tests/auto/testlib')
-rw-r--r-- | tests/auto/testlib/selftests/datetime/tst_datetime.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/auto/testlib/selftests/datetime/tst_datetime.cpp b/tests/auto/testlib/selftests/datetime/tst_datetime.cpp index 22e190404f..abe912550d 100644 --- a/tests/auto/testlib/selftests/datetime/tst_datetime.cpp +++ b/tests/auto/testlib/selftests/datetime/tst_datetime.cpp @@ -4,6 +4,7 @@ #include <QtCore/QCoreApplication> #include <QtCore/QDateTime> +#include <QtCore/QTimeZone> #include <QTest> /*! @@ -21,8 +22,10 @@ private slots: void tst_DateTime::dateTime() const { - const QDateTime utc(QDate(2000, 5, 3), QTime(4, 3, 4), Qt::UTC); - const QDateTime local(QDate(2000, 5, 3), QTime(4, 3, 4), Qt::OffsetFromUTC, 120 /* 2 minutes */); + const auto twoMinutes = std::chrono::minutes{2}; + const QDateTime utc(QDate(2000, 5, 3), QTime(4, 3, 4), QTimeZone::UTC); + const QDateTime local(QDate(2000, 5, 3), QTime(4, 3, 4), + QTimeZone::fromDurationAheadOfUtc(twoMinutes)); QCOMPARE(local, utc); } |