Codebase list golang-github-vbauerster-mpb / 3fe1da0
consistent default format "% d" among percentage/counters/speed Vladimir Bauer 3 years ago
3 changed file(s) with 5 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
150150 // format="% f" output: "12.000000 MiB"
151151 func Current(unit interface{}, format string, wcc ...WC) Decorator {
152152 if format == "" {
153 format = "%d"
153 format = "% d"
154154 }
155155 producer := func() DecorFunc {
156156 switch unit.(type) {
6767 // unit=SizeB1000(0), format="% .1f" output: "1.0 MB/s"
6868 func MovingAverageSpeed(unit interface{}, format string, average ewma.MovingAverage, wcc ...WC) Decorator {
6969 if format == "" {
70 format = "%.0f"
70 format = "% d"
7171 }
7272 d := &movingAverageSpeed{
7373 WC: initWC(wcc...),
128128 // unit=SizeB1000(0), format="% .1f" output: "1.0 MB/s"
129129 func NewAverageSpeed(unit interface{}, format string, startTime time.Time, wcc ...WC) Decorator {
130130 if format == "" {
131 format = "%.0f"
131 format = "% d"
132132 }
133133 d := &averageSpeed{
134134 WC: initWC(wcc...),
1919 fmt: "",
2020 current: 0,
2121 elapsed: time.Second,
22 expected: "0b/s",
22 expected: "0 b/s",
2323 },
2424 {
2525 name: "SizeB1024(0):%d:0b",
147147 fmt: "",
148148 current: 0,
149149 elapsed: time.Second,
150 expected: "0b/s",
150 expected: "0 b/s",
151151 },
152152 {
153153 name: "SizeB1000(0):%d:0b",