Fix ETA display when rate and/or rate_min are specified
authoraggieNick02 <nick@pcpartpicker.com>
Mon, 14 Feb 2022 21:13:50 +0000 (15:13 -0600)
committeraggieNick02 <nick@pcpartpicker.com>
Tue, 15 Feb 2022 17:45:13 +0000 (11:45 -0600)
The base passed to num2str in the ETA display code passed the wrong
base (0 instead of 1). Additionally, je->sig_figs was never set and
defaulted to 0. Both of these caused the desired range in the ETA code
to always display 0-0 when rate or rate_min was specified.

Signed-off-by: Nick Neumann nick@pcpartpicker.com
eta.c

diff --git a/eta.c b/eta.c
index ea1781f3b792147636210f38714abb089870a2da..17970c78dbfd94261403b6c67c536e875ad65fdb 100644 (file)
--- a/eta.c
+++ b/eta.c
@@ -420,6 +420,7 @@ bool calc_thread_status(struct jobs_eta *je, int force)
                if (is_power_of_2(td->o.kb_base))
                        je->is_pow2 = 1;
                je->unit_base = td->o.unit_base;
+               je->sig_figs = td->o.sig_figs;
                if (td->o.bw_avg_time < bw_avg_time)
                        bw_avg_time = td->o.bw_avg_time;
                if (td->runstate == TD_RUNNING || td->runstate == TD_VERIFYING
@@ -600,9 +601,9 @@ void display_thread_status(struct jobs_eta *je)
                char *tr, *mr;
 
                mr = num2str(je->m_rate[0] + je->m_rate[1] + je->m_rate[2],
-                               je->sig_figs, 0, je->is_pow2, N2S_BYTEPERSEC);
+                               je->sig_figs, 1, je->is_pow2, N2S_BYTEPERSEC);
                tr = num2str(je->t_rate[0] + je->t_rate[1] + je->t_rate[2],
-                               je->sig_figs, 0, je->is_pow2, N2S_BYTEPERSEC);
+                               je->sig_figs, 1, je->is_pow2, N2S_BYTEPERSEC);
 
                p += sprintf(p, ", %s-%s", mr, tr);
                free(tr);