comparison 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
comparison
equal deleted inserted replaced
4766:388d108f6e4b 4767:e1711b6e141f
68 float ms = static_cast<float>(runtime_.total_milliseconds()); 68 float ms = static_cast<float>(runtime_.total_milliseconds());
69 69
70 if (status_.GetProgress() > 0.01f && 70 if (status_.GetProgress() > 0.01f &&
71 ms > 0.01f) 71 ms > 0.01f)
72 { 72 {
73 float ratio = static_cast<float>(1.0 - status_.GetProgress()); 73 float progress = status_.GetProgress();
74 long long remaining = boost::math::llround(ratio * ms); 74 long long remaining = boost::math::llround(ms / progress * (1.0f - progress));
75 eta_ = timestamp_ + boost::posix_time::milliseconds(remaining); 75 eta_ = timestamp_ + boost::posix_time::milliseconds(remaining);
76 hasEta_ = true; 76 hasEta_ = true;
77 } 77 }
78 } 78 }
79 } 79 }