From 09bdbf95c43570e4dd371234538871449c2f125a Mon Sep 17 00:00:00 2001 From: Justin Date: Fri, 28 Nov 2025 11:40:51 +0100 Subject: [PATCH] Update eta.go --- common/eta.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/eta.go b/common/eta.go index 72c838f93d..3d192dbc97 100644 --- a/common/eta.go +++ b/common/eta.go @@ -21,10 +21,11 @@ import "time" // CalculateETA calculates the estimated remaining time based on the // number of finished task, remaining task, and the time cost for finished task. func CalculateETA(done, left uint64, elapsed time.Duration) time.Duration { - if done == 0 || elapsed.Milliseconds() == 0 { + ms := elapsed.Milliseconds() + if done == 0 || ms == 0 { return 0 } - speed := float64(done) / float64(elapsed.Milliseconds()) + speed := float64(done) / float64(ms) return time.Duration(float64(left)/speed) * time.Millisecond }