Skip to content

Commit

Permalink
fix when rendering blank
Browse files Browse the repository at this point in the history
  • Loading branch information
schollz committed Nov 17, 2021
1 parent 2cc3618 commit 7486f6b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion progressbar.go
Expand Up @@ -729,7 +729,11 @@ func renderProgressBar(c config, s *state) (int, error) {
// show time prediction in "current/total" seconds format
if c.predictTime {
leftBrac = (time.Duration(time.Since(s.startTime).Seconds()) * time.Second).String()
rightBrac = (time.Duration((1/averageRate)*(float64(c.max)-float64(s.currentNum))) * time.Second).String()
rightBracNum := (time.Duration((1/averageRate)*(float64(c.max)-float64(s.currentNum))) * time.Second)
if rightBracNum.Seconds() < 0 {
rightBracNum = 0 * time.Second
}
rightBrac = rightBracNum.String()
}

if c.fullWidth && !c.ignoreLength {
Expand Down

0 comments on commit 7486f6b

Please sign in to comment.