Codebase list golang-github-vbauerster-mpb / 63a3073
speedPerSecond Vladimir Bauer 6 years ago
1 changed file(s) with 5 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
2222 io.WriteString(st, self.perSecond)
2323 }
2424
25 func sizePerSecond(sizeT fmt.Formatter) fmt.Formatter {
25 func speedPerSecond(sizeT fmt.Formatter) fmt.Formatter {
2626 return &speedType{
2727 sizeT: sizeT,
2828 perSecond: perSecond,
9494
9595 switch d.unit {
9696 case UnitKiB:
97 d.msg = fmt.Sprintf(d.fmt, SizeB1024(math.Round(speed)))
97 d.msg = fmt.Sprintf(d.fmt, speedPerSecond(SizeB1024(math.Round(speed))))
9898 case UnitKB:
99 d.msg = fmt.Sprintf(d.fmt, SizeB1000(math.Round(speed)))
99 d.msg = fmt.Sprintf(d.fmt, speedPerSecond(SizeB1000(math.Round(speed))))
100100 default:
101101 d.msg = fmt.Sprintf(d.fmt, speed)
102102 }
184184
185185 switch d.unit {
186186 case UnitKiB:
187 d.msg = fmt.Sprintf(d.fmt, sizePerSecond(SizeB1024(math.Round(speed))))
187 d.msg = fmt.Sprintf(d.fmt, speedPerSecond(SizeB1024(math.Round(speed))))
188188 case UnitKB:
189 d.msg = fmt.Sprintf(d.fmt, sizePerSecond(SizeB1000(math.Round(speed))))
189 d.msg = fmt.Sprintf(d.fmt, speedPerSecond(SizeB1000(math.Round(speed))))
190190 default:
191191 d.msg = fmt.Sprintf(d.fmt, speed)
192192 }