diff options
Diffstat (limited to 'apt-pkg/contrib/progress.cc')
-rw-r--r-- | apt-pkg/contrib/progress.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/apt-pkg/contrib/progress.cc b/apt-pkg/contrib/progress.cc index 7c5b15e6b..5499f0946 100644 --- a/apt-pkg/contrib/progress.cc +++ b/apt-pkg/contrib/progress.cc @@ -14,6 +14,7 @@ #include <apt-pkg/error.h> #include <apt-pkg/progress.h> +#include <cmath> #include <cstring> #include <iostream> #include <string> @@ -44,7 +45,7 @@ void OpProgress::Progress(unsigned long long Cur) if (Total == 0 || Size == 0 || SubTotal == 0) Percent = 0; else - Percent = (Current + Cur/((float)SubTotal)*Size)*100.0/Total; + Percent = (Current + Cur/((double)SubTotal)*Size)*100.0/Total; Update(); } /*}}}*/ @@ -106,7 +107,7 @@ bool OpProgress::CheckChange(float Interval) return true; } - if ((int)LastPercent == (int)Percent) + if (std::lround(LastPercent) == std::lround(Percent)) return false; LastPercent = Percent; |