changeset 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 388d108f6e4b
children a046e91cc76f
files NEWS OrthancFramework/Sources/JobsEngine/JobInfo.cpp
diffstat 2 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Mon Aug 16 10:54:38 2021 +0200
+++ b/NEWS	Wed Aug 18 15:16:39 2021 +0200
@@ -14,6 +14,7 @@
 * Added file CITATION.cff
 * Linux Standard Base (LSB) builds of Orthanc can load non-LSB builds of plugins
 * Fix upload of ZIP archives containing a DICOMDIR file
+* Fix computation of the estimated time of arrival in jobs
 
 
 Version 1.9.6 (2021-07-21)
--- 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;
       }