Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions src/libsync/progressdispatcher.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/*
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2013 ownCloud GmbH
Expand Down Expand Up @@ -370,14 +370,17 @@

ProgressInfo::Estimates ProgressInfo::Progress::estimates() const
{
Estimates est{};
est.estimatedBandwidth = _progressPerSec;
if (_progressPerSec != 0) {
est.estimatedEta = qRound64(static_cast<double>(_total - _completed) / _progressPerSec) * 1000;
Estimates estimation{};
estimation.estimatedBandwidth = _progressPerSec;
if (const auto progress = _total - _completed;
_progressPerSec != 0 && progress > _progressPerSec) {

Check warning on line 376 in src/libsync/progressdispatcher.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

implicit conversion from 'const qint64' (aka 'const long long') to 'double' may lose precision

See more on https://sonarcloud.io/project/issues?id=nextcloud_desktop&issues=AZz2CDbob7EmdOjToH3f&open=AZz2CDbob7EmdOjToH3f&pullRequest=9632
const auto progressinDouble = static_cast<double>(progress);
const auto estimatedEta = progressinDouble / _progressPerSec;
estimation.estimatedEta = qRound64(estimatedEta) * 1000;
} else {
est.estimatedEta = 0; // looks better than qint64 max
estimation.estimatedEta = 0; // looks better than qint64 max
}
return est;
return estimation;
}

qint64 ProgressInfo::Progress::completed() const
Expand Down
Loading