Open suomela opened 1 year ago
"Intentional" is a big word. :smile: I suppose we don't ever store the time when we finished, so we don't really have any better value we can show here. I suppose we could add an Instant
to the Done
variants of Status
?
@djc To me it seems that elapsed
works well both before and after finish
, and eta
is explicitly set to 0 after finish
, so if we just removed the part || self.is_finished()
in line 293 and let it fall back to elapsed
+ eta
, shouldn't it behave better?
I tried it out here and it seems to work: https://github.com/suomela/indicatif — there's examples/elapsed-duration.rs
for playing with this, and a one-line fix attempt in this commit.
It might work well immediately after finish, but if a redraw happens sometime after finishing, then elapsed will continue to move forward, which I don't think makes sense.
I see, I think {elapsed}
then has the same issue with redraws?
I was talking about elapsed
. I haven't actually tried but based on the code I think that would be the effect.
If I have got a
ProgressBar
withProgressStyle
that uses a template like"… {elapsed}/{duration} …"
. As usual, I repeatedly call.inc(…)
and finally.finish()
. However, I am typically getting this kind of printout:That is, the estimated total duration makes plenty of sense, except that after calling
finish
it drops to 0. I would expect thatduration
would reflect the real final duration when the progress bar is finished.I guess the problem is around lines 292–297 of
src/state.rs
:It seems to be explicitly returning 0 when
is_finished()
. Is this intentional?