diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2018-01-24 00:51:25 +0300 |
---|---|---|
committer | Camila San <hello@camila.codes> | 2018-06-06 18:26:53 +0300 |
commit | 073a5184cb1dcb491c6f0b4866ac9a6e9d0dc6e3 (patch) | |
tree | ae6ea365401788de89ec227e746748091857038d /src/gui/folder.cpp | |
parent | ea58a1038b989a2ab7f9d5e9e3a33c8be24dd2ae (diff) |
Use std::chrono::milliseconds to represent milliseconds
Diffstat (limited to 'src/gui/folder.cpp')
-rw-r--r-- | src/gui/folder.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index b781f894a..56f2b302d 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -635,18 +635,17 @@ void Folder::startSync(const QStringList &pathList) setDirtyNetworkLimits(); setSyncOptions(); - static qint64 fullLocalDiscoveryInterval = []() { + static std::chrono::milliseconds fullLocalDiscoveryInterval = []() { auto interval = ConfigFile().fullLocalDiscoveryInterval(); QByteArray env = qgetenv("OWNCLOUD_FULL_LOCAL_DISCOVERY_INTERVAL"); if (!env.isEmpty()) { - interval = env.toLongLong(); + interval = std::chrono::milliseconds(env.toLongLong()); } return interval; }(); - if (_folderWatcher && _folderWatcher->isReliable() - && _timeSinceLastFullLocalDiscovery.isValid() - && (fullLocalDiscoveryInterval < 0 - || _timeSinceLastFullLocalDiscovery.elapsed() < fullLocalDiscoveryInterval)) { + if (_folderWatcher && _folderWatcher->isReliable() && _timeSinceLastFullLocalDiscovery.isValid() + && (fullLocalDiscoveryInterval.count() < 0 + || _timeSinceLastFullLocalDiscovery.hasExpired(fullLocalDiscoveryInterval.count()))) { qCInfo(lcFolder) << "Allowing local discovery to read from the database"; _engine->setLocalDiscoveryOptions(LocalDiscoveryStyle::DatabaseAndFilesystem, _localDiscoveryPaths); @@ -710,7 +709,7 @@ void Folder::setSyncOptions() QByteArray targetChunkUploadDurationEnv = qgetenv("OWNCLOUD_TARGET_CHUNK_UPLOAD_DURATION"); if (!targetChunkUploadDurationEnv.isEmpty()) { - opt._targetChunkUploadDuration = targetChunkUploadDurationEnv.toUInt(); + opt._targetChunkUploadDuration = std::chrono::milliseconds(targetChunkUploadDurationEnv.toUInt()); } else { opt._targetChunkUploadDuration = cfgFile.targetChunkUploadDuration(); } @@ -832,7 +831,7 @@ void Folder::slotSyncFinished(bool success) // all come in. QTimer::singleShot(200, this, &Folder::slotEmitFinishedDelayed); - _lastSyncDuration = _timeSinceLastSyncStart.elapsed(); + _lastSyncDuration = std::chrono::milliseconds(_timeSinceLastSyncStart.elapsed()); _timeSinceLastSyncDone.start(); // Increment the follow-up sync counter if necessary. |