diff OrthancFramework/Sources/JobsEngine/JobInfo.cpp @ 4767:e1711b6e141f

Fix computation of the estimated time of arrival in jobs
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 18 Aug 2021 15:16:39 +0200
parents 08ee98bf103e
children 7053502fbf97
line wrap: on
line diff
--- a/OrthancFramework/Sources/JobsEngine/JobInfo.cpp	Mon Aug 16 10:54:38 2021 +0200
+++ b/OrthancFramework/Sources/JobsEngine/JobInfo.cpp	Wed Aug 18 15:16:39 2021 +0200
@@ -70,8 +70,8 @@
       if (status_.GetProgress() > 0.01f &&
           ms > 0.01f)
       {
-        float ratio = static_cast<float>(1.0 - status_.GetProgress());
-        long long remaining = boost::math::llround(ratio * ms);
+        float progress = status_.GetProgress();
+        long long remaining = boost::math::llround(ms / progress * (1.0f - progress));
         eta_ = timestamp_ + boost::posix_time::milliseconds(remaining);
         hasEta_ = true;
       }