From 1cd71ef2f2050f60782bb8b59b58f775767cf14b Mon Sep 17 00:00:00 2001 From: Bart Hakvoort Date: Sun, 3 Sep 2006 20:52:43 +0000 Subject: [PATCH] simplified algorithm to get remaining time * src/GParted_Core.cc: simplified algorithm to get remaining time --- ChangeLog | 4 ++++ src/GParted_Core.cc | 4 +--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f11d645c..3c7d549e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-09-03 Bart Hakvoort + + * src/GParted_Core.cc: simplified algorithm to get remaining time + 2006-09-03 Bart Hakvoort * include/GParted_Core.h, diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc index 4b350c4a..8a5c09dc 100644 --- a/src/GParted_Core.cc +++ b/src/GParted_Core.cc @@ -1651,9 +1651,7 @@ void GParted_Core::set_progress_info( Sector total, { operationdetail .fraction = done / static_cast( total ) ; - double sec_per_frac = timer .elapsed() / operationdetail .fraction ; - - std::time_t time_remaining = Utils::round( (1.0 - operationdetail .fraction) * sec_per_frac ) ; + std::time_t time_remaining = Utils::round( (total - done) / ( done / timer .elapsed() ) ) ; operationdetail .progress_text = String::ucompose( _("%1 of %2 copied (%3 remaining)"), Utils::format_size( done ),