Skip to content

Commit

Permalink
Merge pull request #145 from msyrus/master
Browse files Browse the repository at this point in the history
Fix time left
  • Loading branch information
cheggaaa authored Mar 1, 2019
2 parents 1cc5bbe + 6bf91b3 commit 9bacf61
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions pb.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,9 @@ func (pb *ProgressBar) write(total, current int64) {
perEntry := fromChange / time.Duration(currentFromStart)
var left time.Duration
if total > 0 {
left = time.Duration(total-currentFromStart) * perEntry
left = time.Duration(total-current) * perEntry
left -= time.Since(lastChangeTime)
left = (left / time.Second) * time.Second
} else {
left = time.Duration(currentFromStart) * perEntry
left = (left / time.Second) * time.Second
}
if left > 0 {
timeLeft := Format(int64(left)).To(U_DURATION).String()
Expand Down

0 comments on commit 9bacf61

Please sign in to comment.