Codebase list golang-github-vbauerster-mpb / 24850cc
one math.Round less Vladimir Bauer 6 years ago
1 changed file(s) with 5 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
7676 func (d *movingAverageSpeed) Decor(st *Statistics) string {
7777 if !st.Completed {
7878 var speed float64
79 if v := math.Round(d.average.Value()); v != 0 {
80 speed = 1 / time.Duration(v).Seconds()
79 if v := d.average.Value(); v < 0 {
80 speed = 1 / v
8181 }
82 d.msg = d.producer(speed)
82 d.msg = d.producer(speed * 1e9)
8383 }
8484 return d.FormatMsg(d.msg)
8585 }
145145
146146 func (d *averageSpeed) Decor(st *Statistics) string {
147147 if !st.Completed {
148 speed := float64(st.Current) / time.Since(d.startTime).Seconds()
149 d.msg = d.producer(speed)
148 speed := float64(st.Current) / float64(time.Since(d.startTime))
149 d.msg = d.producer(speed * 1e9)
150150 }
151151
152152 return d.FormatMsg(d.msg)