From 9e49778380c056b1ce7f30dbd774c545bff030c5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 21 Jun 2016 14:27:48 -0700 Subject: Fix/adapt the uses of {to,set,from}Time_t in the qtbase source code Move those to the equivalent {to,set,from}SecsSinceEpoch(), except for the cases that did QDateTime::currentDateTime{,Utc}().toTime_t. Those are best implemented with QDateTime::currentSecsSinceEpoch(). Change-Id: Ib57b52598e2f452985e9fffd145a366c92cfda20 Reviewed-by: Edward Welbourne --- tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp | 2 +- tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp | 2 +- tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 4 ++-- tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp | 2 +- tests/auto/other/networkselftest/tst_networkselftest.cpp | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index eea79406c3..b3527f5d27 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -141,7 +141,7 @@ inline bool qIsLikelyToBeNfs(int /* handle */) static QString seedAndTemplate() { - qsrand(QDateTime::currentDateTimeUtc().toTime_t()); + qsrand(QDateTime::currentSecsSinceEpoch()); return QDir::tempPath() + "/tst_qfileinfo-XXXXXX"; } diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp index 593706ac0d..a7ab221dda 100644 --- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp +++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp @@ -116,7 +116,7 @@ Q_CONSTRUCTOR_FUNCTION(initializeLang) static QString seedAndTemplate() { - qsrand(QDateTime::currentDateTimeUtc().toTime_t()); + qsrand(QDateTime::currentSecsSinceEpoch()); return QDir::tempPath() + "/tst_qmimedatabase-XXXXXX"; } diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index 8c9dc16ce7..8d9a789507 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -145,8 +145,8 @@ tst_QLocale::tst_QLocale() qRegisterMetaType("QLocale::FormatType"); // Test if in Central European Time zone - uint x1 = QDateTime(QDate(1990, 1, 1), QTime()).toTime_t(); - uint x2 = QDateTime(QDate(1990, 6, 1), QTime()).toTime_t(); + uint x1 = QDateTime(QDate(1990, 1, 1), QTime()).toSecsSinceEpoch(); + uint x2 = QDateTime(QDate(1990, 6, 1), QTime()).toSecsSinceEpoch(); europeanTimeZone = (x1 == 631148400 && x2 == 644191200); } diff --git a/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp index 0def290eff..0edc5a92ea 100644 --- a/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp +++ b/tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp @@ -1818,7 +1818,7 @@ void tst_QDBusAbstractAdaptor::typeMatching_data() LLDateTimeMap lldtmap; lldtmap[-1] = QDateTime(); QDateTime now = QDateTime::currentDateTime(); - lldtmap[now.toTime_t()] = now; // array of struct of int64 and struct of 3 ints and struct of 4 ints and int + lldtmap[now.toSecsSinceEpoch()] = now; // array of struct of int64 and struct of 3 ints and struct of 4 ints and int QTest::newRow("lldtmap") << "LLDateTimeMap" << "a{x((iii)(iiii)i)}" << QVariant::fromValue(lldtmap); MyStruct s; diff --git a/tests/auto/other/networkselftest/tst_networkselftest.cpp b/tests/auto/other/networkselftest/tst_networkselftest.cpp index 0ce0e8d0f5..68473906b0 100644 --- a/tests/auto/other/networkselftest/tst_networkselftest.cpp +++ b/tests/auto/other/networkselftest/tst_networkselftest.cpp @@ -539,7 +539,7 @@ void tst_NetworkSelfTest::httpServer() { QByteArray uniqueExtension = QByteArray::number((qulonglong)this) + QByteArray::number((qulonglong)qrand()) + - QByteArray::number((qulonglong)QDateTime::currentDateTime().toTime_t()); + QByteArray::number(QDateTime::currentSecsSinceEpoch()); netChat(80, QList() // HTTP/0.9 chat: -- cgit v1.2.3