Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2017-09-25 12:49:11 +0300
committerOlivier Goffart <olivier@woboq.com>2017-09-26 17:14:17 +0300
commit13e0cc6b501335c4cda9902905f503483237a46a (patch)
tree66ef6178dc05d0d7280ef0221f394a7ee8d2bfa5 /test
parent7af81f76657aa9aed7b3942484f925b9ac9c2574 (diff)
Use QDateTime::currentDateTimeUtc instead of the non utc version
QDateTime::currentDateTime is terribly slow.
Diffstat (limited to 'test')
-rw-r--r--test/mockserver/httpserver.cpp2
-rw-r--r--test/syncenginetestutils.h4
-rw-r--r--test/testsyncengine.cpp8
3 files changed, 7 insertions, 7 deletions
diff --git a/test/mockserver/httpserver.cpp b/test/mockserver/httpserver.cpp
index c1f2a0cee..fbc24e847 100644
--- a/test/mockserver/httpserver.cpp
+++ b/test/mockserver/httpserver.cpp
@@ -32,7 +32,7 @@ void HttpServer::readClient()
"Content-Type: text/html; charset=\"utf-8\"\r\n"
"\r\n"
"<h1>Nothing to see here</h1>\n"
- << QDateTime::currentDateTime().toString() << "\n";
+ << QDateTime::currentDateTimeUtc().toString() << "\n";
socket->close();
QtServiceBase::instance()->logMessage("Wrote to client");
diff --git a/test/syncenginetestutils.h b/test/syncenginetestutils.h
index cabac73bf..9253b6285 100644
--- a/test/syncenginetestutils.h
+++ b/test/syncenginetestutils.h
@@ -41,7 +41,7 @@ inline QString getFilePathFromUrl(const QUrl &url) {
inline QString generateEtag() {
- return QString::number(QDateTime::currentDateTime().toMSecsSinceEpoch(), 16);
+ return QString::number(QDateTime::currentDateTimeUtc().toMSecsSinceEpoch(), 16);
}
inline QByteArray generateFileId() {
return QByteArray::number(qrand(), 16);
@@ -97,7 +97,7 @@ public:
file.write(buf.data(), size % buf.size());
file.close();
// Set the mtime 30 seconds in the past, for some tests that need to make sure that the mtime differs.
- OCC::FileSystem::setModTime(file.fileName(), OCC::Utility::qDateTimeToTime_t(QDateTime::currentDateTime().addSecs(-30)));
+ OCC::FileSystem::setModTime(file.fileName(), OCC::Utility::qDateTimeToTime_t(QDateTime::currentDateTimeUtc().addSecs(-30)));
QCOMPARE(file.size(), size);
}
void setContents(const QString &relativePath, char contentChar) override {
diff --git a/test/testsyncengine.cpp b/test/testsyncengine.cpp
index a4c4c5be4..169c2e6fb 100644
--- a/test/testsyncengine.cpp
+++ b/test/testsyncengine.cpp
@@ -358,7 +358,7 @@ private slots:
FileInfo &remoteInfo = dynamic_cast<FileInfo &>(fakeFolder.remoteModifier());
// Base mtime with no ms content (filesystem is seconds only)
- auto mtime = QDateTime::currentDateTime().addDays(-4);
+ auto mtime = QDateTime::currentDateTimeUtc().addDays(-4);
mtime.setMSecsSinceEpoch(mtime.toMSecsSinceEpoch() / 1000 * 1000);
// Conflict: Same content, mtime, but no server checksum
@@ -414,9 +414,9 @@ private slots:
*/
void testSyncFileItemProperties()
{
- auto initialMtime = QDateTime::currentDateTime().addDays(-7);
- auto changedMtime = QDateTime::currentDateTime().addDays(-4);
- auto changedMtime2 = QDateTime::currentDateTime().addDays(-3);
+ auto initialMtime = QDateTime::currentDateTimeUtc().addDays(-7);
+ auto changedMtime = QDateTime::currentDateTimeUtc().addDays(-4);
+ auto changedMtime2 = QDateTime::currentDateTimeUtc().addDays(-3);
// Base mtime with no ms content (filesystem is seconds only)
initialMtime.setMSecsSinceEpoch(initialMtime.toMSecsSinceEpoch() / 1000 * 1000);