From 548513a4bd050d3df0a85fed6e2d1a00ce06d2ab Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 27 May 2019 17:47:22 +0200 Subject: Separate out the time, zone, date code from corelib/tools/ We'll be adding calendar code here as well, and tools/ was getting rather crowded, so it looks like time to move out a reasonably coherent sub-bundle of it all. Change-Id: I7e8030f38c31aa307f519dd918a43fc44baa6aa1 Reviewed-by: Lars Knoll --- tests/benchmarks/corelib/tools/qdate/qdate.pro | 4 - .../corelib/tools/qdate/tst_bench_qdate.cpp | 53 -- tests/benchmarks/corelib/tools/qdatetime/main.cpp | 601 --------------------- .../corelib/tools/qdatetime/qdatetime.pro | 4 - tests/benchmarks/corelib/tools/qtimezone/main.cpp | 52 -- .../corelib/tools/qtimezone/qtimezone.pro | 4 - tests/benchmarks/corelib/tools/tools.pro | 2 - 7 files changed, 720 deletions(-) delete mode 100644 tests/benchmarks/corelib/tools/qdate/qdate.pro delete mode 100644 tests/benchmarks/corelib/tools/qdate/tst_bench_qdate.cpp delete mode 100644 tests/benchmarks/corelib/tools/qdatetime/main.cpp delete mode 100644 tests/benchmarks/corelib/tools/qdatetime/qdatetime.pro delete mode 100644 tests/benchmarks/corelib/tools/qtimezone/main.cpp delete mode 100644 tests/benchmarks/corelib/tools/qtimezone/qtimezone.pro (limited to 'tests/benchmarks/corelib/tools') diff --git a/tests/benchmarks/corelib/tools/qdate/qdate.pro b/tests/benchmarks/corelib/tools/qdate/qdate.pro deleted file mode 100644 index a655917135..0000000000 --- a/tests/benchmarks/corelib/tools/qdate/qdate.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_bench_qdate -QT = core testlib - -SOURCES += tst_bench_qdate.cpp diff --git a/tests/benchmarks/corelib/tools/qdate/tst_bench_qdate.cpp b/tests/benchmarks/corelib/tools/qdate/tst_bench_qdate.cpp deleted file mode 100644 index 399ac44065..0000000000 --- a/tests/benchmarks/corelib/tools/qdate/tst_bench_qdate.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -class tst_QDate : public QObject -{ - Q_OBJECT - -private Q_SLOTS: - void monthLengths(); -}; - -void tst_QDate::monthLengths() -{ - QBENCHMARK { - for (int year = 1900; year <= 2100; year++) { - bool check = true; - for (int month = 1; month <= 12; month++) - check &= QDate::isValid(year, month, QDate(year, month, 1).daysInMonth()); - Q_UNUSED(check); - } - } -} - -QTEST_MAIN(tst_QDate) -#include "tst_bench_qdate.moc" diff --git a/tests/benchmarks/corelib/tools/qdatetime/main.cpp b/tests/benchmarks/corelib/tools/qdatetime/main.cpp deleted file mode 100644 index b693400376..0000000000 --- a/tests/benchmarks/corelib/tools/qdatetime/main.cpp +++ /dev/null @@ -1,601 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include - -class tst_QDateTime : public QObject -{ - Q_OBJECT - - enum : qint64 - { - SECS_PER_DAY = 86400, - MSECS_PER_DAY = 86400000, - JULIAN_DAY_1950 = 2433283, - JULIAN_DAY_1960 = 2436935, - JULIAN_DAY_2010 = 2455198, - JULIAN_DAY_2011 = 2455563, - JULIAN_DAY_2020 = 2458850, - JULIAN_DAY_2050 = 2469808, - JULIAN_DAY_2060 = 2473460 - }; - -private Q_SLOTS: - void create(); - void isNull(); - void isValid(); - void date(); - void time(); - void timeSpec(); - void offsetFromUtc(); - void timeZoneAbbreviation(); - void toMSecsSinceEpoch(); - void toMSecsSinceEpoch1950(); - void toMSecsSinceEpoch2050(); - void toMSecsSinceEpochTz(); - void toMSecsSinceEpoch1950Tz(); - void toMSecsSinceEpoch2050Tz(); - void setDate(); - void setTime(); - void setTimeSpec(); - void setOffsetFromUtc(); - void setMSecsSinceEpoch(); - void setMSecsSinceEpochTz(); - void toString(); - void toStringTextFormat(); - void toStringIsoFormat(); - void addDays(); - void addDaysTz(); - void addMSecs(); - void addMSecsTz(); - void toTimeSpec(); - void toOffsetFromUtc(); - void daysTo(); - void msecsTo(); - void equivalent(); - void equivalentUtc(); - void lessThan(); - void lessThanUtc(); - void currentDateTime(); - void currentDate(); - void currentTime(); - void currentDateTimeUtc(); - void currentMSecsSinceEpoch(); - void fromString(); - void fromStringText(); - void fromStringIso(); - void fromMSecsSinceEpoch(); - void fromMSecsSinceEpochUtc(); - void fromMSecsSinceEpochTz(); -}; - -void tst_QDateTime::create() -{ - QBENCHMARK { - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) { - QDateTime test(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0)); - Q_UNUSED(test) - } - } -} - -void tst_QDateTime::isNull() -{ - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (const QDateTime &test, list) - test.isNull(); - } -} - -void tst_QDateTime::isValid() -{ - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (const QDateTime &test, list) - test.isValid(); - } -} - -void tst_QDateTime::date() -{ - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (const QDateTime &test, list) - test.date(); - } -} - -void tst_QDateTime::time() -{ - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (const QDateTime &test, list) - test.time(); - } -} - -void tst_QDateTime::timeSpec() -{ - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (const QDateTime &test, list) - test.timeSpec(); - } -} - -void tst_QDateTime::offsetFromUtc() -{ - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (const QDateTime &test, list) - test.offsetFromUtc(); - } -} - -void tst_QDateTime::timeZoneAbbreviation() -{ - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (const QDateTime &test, list) - test.timeZoneAbbreviation(); - } -} - -void tst_QDateTime::toMSecsSinceEpoch() -{ - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (const QDateTime &test, list) - test.toMSecsSinceEpoch(); - } -} - -void tst_QDateTime::toMSecsSinceEpoch1950() -{ - QList list; - for (int jd = JULIAN_DAY_1950; jd < JULIAN_DAY_1960; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (const QDateTime &test, list) - test.toMSecsSinceEpoch(); - } -} - -void tst_QDateTime::toMSecsSinceEpoch2050() -{ - QList list; - for (int jd = JULIAN_DAY_2050; jd < JULIAN_DAY_2060; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (const QDateTime &test, list) - test.toMSecsSinceEpoch(); - } -} - -void tst_QDateTime::toMSecsSinceEpochTz() -{ - QTimeZone cet = QTimeZone("Europe/Oslo"); - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0), cet)); - QBENCHMARK { - foreach (const QDateTime &test, list) - qint64 result = test.toMSecsSinceEpoch(); - } -} - -void tst_QDateTime::toMSecsSinceEpoch1950Tz() -{ - QTimeZone cet = QTimeZone("Europe/Oslo"); - QList list; - for (int jd = JULIAN_DAY_1950; jd < JULIAN_DAY_1960; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0), cet)); - QBENCHMARK { - foreach (const QDateTime &test, list) - qint64 result = test.toMSecsSinceEpoch(); - } -} - -void tst_QDateTime::toMSecsSinceEpoch2050Tz() -{ - QTimeZone cet = QTimeZone("Europe/Oslo"); - QList list; - for (int jd = JULIAN_DAY_2050; jd < JULIAN_DAY_2060; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0), cet)); - QBENCHMARK { - foreach (const QDateTime &test, list) - qint64 result = test.toMSecsSinceEpoch(); - } -} - -void tst_QDateTime::setDate() -{ - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (QDateTime test, list) - test.setDate(QDate::fromJulianDay(JULIAN_DAY_2010)); - } -} - -void tst_QDateTime::setTime() -{ - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (QDateTime test, list) - test.setTime(QTime(12, 0, 0)); - } -} - -void tst_QDateTime::setTimeSpec() -{ - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (QDateTime test, list) - test.setTimeSpec(Qt::UTC); - } -} - -void tst_QDateTime::setOffsetFromUtc() -{ - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (QDateTime test, list) - test.setOffsetFromUtc(3600); - } -} - -void tst_QDateTime::setMSecsSinceEpoch() -{ - qint64 msecs = qint64(JULIAN_DAY_2010 + 180) * MSECS_PER_DAY; - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (QDateTime test, list) - test.setMSecsSinceEpoch(msecs); - } -} - -void tst_QDateTime::setMSecsSinceEpochTz() -{ - QTimeZone cet = QTimeZone("Europe/Oslo"); - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0), cet)); - QBENCHMARK { - foreach (QDateTime test, list) - test.setMSecsSinceEpoch((JULIAN_DAY_2010 + 180) * MSECS_PER_DAY); - } -} - -void tst_QDateTime::toString() -{ - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2011; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (const QDateTime &test, list) - test.toString(QStringLiteral("yyy-MM-dd hh:mm:ss.zzz t")); - } -} - -void tst_QDateTime::toStringTextFormat() -{ - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2011; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (const QDateTime &test, list) - test.toString(Qt::TextDate); - } -} - -void tst_QDateTime::toStringIsoFormat() -{ - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2011; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (const QDateTime &test, list) - test.toString(Qt::ISODate); - } -} - -void tst_QDateTime::addDays() -{ - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (const QDateTime &test, list) - test.addDays(1); - } -} - -void tst_QDateTime::addDaysTz() -{ - QTimeZone cet = QTimeZone("Europe/Oslo"); - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0), cet)); - QBENCHMARK { - foreach (const QDateTime &test, list) - QDateTime result = test.addDays(1); - } -} - -void tst_QDateTime::addMSecs() -{ - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (const QDateTime &test, list) - test.addMSecs(1); - } -} - -void tst_QDateTime::addMSecsTz() -{ - QTimeZone cet = QTimeZone("Europe/Oslo"); - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0), cet)); - QBENCHMARK { - foreach (const QDateTime &test, list) - QDateTime result = test.addMSecs(1); - } -} - -void tst_QDateTime::toTimeSpec() -{ - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (const QDateTime &test, list) - test.toTimeSpec(Qt::UTC); - } -} - -void tst_QDateTime::toOffsetFromUtc() -{ - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (const QDateTime &test, list) - test.toOffsetFromUtc(3600); - } -} - -void tst_QDateTime::daysTo() -{ - QDateTime other = QDateTime::fromMSecsSinceEpoch(qint64(JULIAN_DAY_2010) * MSECS_PER_DAY); - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (const QDateTime &test, list) - test.daysTo(other); - } -} - -void tst_QDateTime::msecsTo() -{ - QDateTime other = QDateTime::fromMSecsSinceEpoch(qint64(JULIAN_DAY_2010) * MSECS_PER_DAY); - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (const QDateTime &test, list) - test.msecsTo(other); - } -} - -void tst_QDateTime::equivalent() -{ - bool result; - QDateTime other = QDateTime::fromMSecsSinceEpoch(qint64(JULIAN_DAY_2010) * MSECS_PER_DAY); - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (const QDateTime &test, list) - result = (test == other); - } - Q_UNUSED(result) -} - -void tst_QDateTime::equivalentUtc() -{ - bool result = false; - QDateTime other = QDateTime::fromMSecsSinceEpoch(qint64(JULIAN_DAY_2010) * MSECS_PER_DAY, Qt::UTC); - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (const QDateTime &test, list) - result = (test == other); - } - Q_UNUSED(result) -} - -void tst_QDateTime::lessThan() -{ - bool result = false; - QDateTime other = QDateTime::fromMSecsSinceEpoch(qint64(JULIAN_DAY_2010) * MSECS_PER_DAY); - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (const QDateTime &test, list) - result = (test < other); - } - Q_UNUSED(result) -} - -void tst_QDateTime::lessThanUtc() -{ - bool result = false; - QDateTime other = QDateTime::fromMSecsSinceEpoch(qint64(JULIAN_DAY_2010) * MSECS_PER_DAY, Qt::UTC); - QList list; - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - list.append(QDateTime(QDate::fromJulianDay(jd), QTime::fromMSecsSinceStartOfDay(0))); - QBENCHMARK { - foreach (const QDateTime &test, list) - result = (test < other); - } - Q_UNUSED(result) -} - -void tst_QDateTime::currentDateTime() -{ - QBENCHMARK { - for (int i = 0; i < 1000; ++i) - QDateTime::currentDateTime(); - } -} - -void tst_QDateTime::currentDate() -{ - QBENCHMARK { - for (int i = 0; i < 1000; ++i) - QDate::currentDate(); - } -} - -void tst_QDateTime::currentTime() -{ - QBENCHMARK { - for (int i = 0; i < 1000; ++i) - QTime::currentTime(); - } -} - -void tst_QDateTime::currentDateTimeUtc() -{ - QBENCHMARK { - for (int i = 0; i < 1000; ++i) - QDateTime::currentDateTimeUtc(); - } -} - -void tst_QDateTime::currentMSecsSinceEpoch() -{ - QBENCHMARK { - for (int i = 0; i < 1000; ++i) - QDateTime::currentMSecsSinceEpoch(); - } -} - -void tst_QDateTime::fromString() -{ - QString format = "yyyy-MM-dd hh:mm:ss.zzz"; - QString input = "2010-01-01 13:12:11.999"; - QVERIFY(QDateTime::fromString(input, format).isValid()); - QBENCHMARK { - for (int i = 0; i < 1000; ++i) - QDateTime::fromString(input, format); - } -} - -void tst_QDateTime::fromStringText() -{ - QString input = "Wed Jan 2 01:02:03.000 2013 GMT"; - QBENCHMARK { - for (int i = 0; i < 1000; ++i) - QDateTime::fromString(input, Qt::TextDate); - } -} - -void tst_QDateTime::fromStringIso() -{ - QString input = "2010-01-01T13:28:34.999Z"; - QBENCHMARK { - for (int i = 0; i < 1000; ++i) - QDateTime::fromString(input, Qt::ISODate); - } -} - -void tst_QDateTime::fromMSecsSinceEpoch() -{ - QBENCHMARK { - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - QDateTime::fromMSecsSinceEpoch(jd * MSECS_PER_DAY, Qt::LocalTime); - } -} - -void tst_QDateTime::fromMSecsSinceEpochUtc() -{ - QBENCHMARK { - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - QDateTime::fromMSecsSinceEpoch(jd * MSECS_PER_DAY, Qt::UTC); - } -} - -void tst_QDateTime::fromMSecsSinceEpochTz() -{ - QTimeZone cet = QTimeZone("Europe/Oslo"); - QBENCHMARK { - for (int jd = JULIAN_DAY_2010; jd < JULIAN_DAY_2020; ++jd) - QDateTime test = QDateTime::fromMSecsSinceEpoch(jd * MSECS_PER_DAY, cet); - } -} - -QTEST_MAIN(tst_QDateTime) - -#include "main.moc" diff --git a/tests/benchmarks/corelib/tools/qdatetime/qdatetime.pro b/tests/benchmarks/corelib/tools/qdatetime/qdatetime.pro deleted file mode 100644 index a85e7346c6..0000000000 --- a/tests/benchmarks/corelib/tools/qdatetime/qdatetime.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_bench_qdatetime -QT = core testlib - -SOURCES += main.cpp diff --git a/tests/benchmarks/corelib/tools/qtimezone/main.cpp b/tests/benchmarks/corelib/tools/qtimezone/main.cpp deleted file mode 100644 index 65455a7261..0000000000 --- a/tests/benchmarks/corelib/tools/qtimezone/main.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -class tst_QTimeZone : public QObject -{ - Q_OBJECT - -private Q_SLOTS: - void isTimeZoneIdAvailable(); -}; - -void tst_QTimeZone::isTimeZoneIdAvailable() -{ - const QList available = QTimeZone::availableTimeZoneIds(); - QBENCHMARK { - for (const QByteArray &id : available) - QVERIFY(QTimeZone::isTimeZoneIdAvailable(id)); - } -} - -QTEST_MAIN(tst_QTimeZone) - -#include "main.moc" diff --git a/tests/benchmarks/corelib/tools/qtimezone/qtimezone.pro b/tests/benchmarks/corelib/tools/qtimezone/qtimezone.pro deleted file mode 100644 index d0531b568b..0000000000 --- a/tests/benchmarks/corelib/tools/qtimezone/qtimezone.pro +++ /dev/null @@ -1,4 +0,0 @@ -TARGET = tst_bench_qtimezone -QT = core testlib - -SOURCES += main.cpp diff --git a/tests/benchmarks/corelib/tools/tools.pro b/tests/benchmarks/corelib/tools/tools.pro index ca9c0a6f89..33cbe00438 100644 --- a/tests/benchmarks/corelib/tools/tools.pro +++ b/tests/benchmarks/corelib/tools/tools.pro @@ -5,7 +5,6 @@ SUBDIRS = \ qbytearray \ qcontiguouscache \ qcryptographichash \ - qdatetime \ qlist \ qlocale \ qmap \ @@ -15,7 +14,6 @@ SUBDIRS = \ qstring \ qstringbuilder \ qstringlist \ - qtimezone \ qvector \ qalgorithms -- cgit v1.2.3 From 3e75c2965c96fa014ab74121e84d623fd04a27f7 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 10 Jun 2019 00:09:10 +0200 Subject: Remove QLatin1Literal usages That's an undocumented Qt 4/3/2 remnant, start remove usages. Fix incorrect include header in qclass_lib_map.h as a drive-by. Change-Id: I939be2621bc03e5c75f7e3f152546d3af6d37b91 Reviewed-by: Marc Mutz Reviewed-by: Thiago Macieira --- tests/benchmarks/corelib/tools/qstringbuilder/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/benchmarks/corelib/tools') diff --git a/tests/benchmarks/corelib/tools/qstringbuilder/main.cpp b/tests/benchmarks/corelib/tools/qstringbuilder/main.cpp index d0dfe3b1a7..0de6d33846 100644 --- a/tests/benchmarks/corelib/tools/qstringbuilder/main.cpp +++ b/tests/benchmarks/corelib/tools/qstringbuilder/main.cpp @@ -401,7 +401,7 @@ private slots: } private: - const QLatin1Literal l1literal; + const QLatin1String l1literal; const QLatin1String l1string; const QByteArray ba; const QString string; -- cgit v1.2.3