Commit 390a88b7 authored by Steven Allen's avatar Steven Allen

make the example compile...

parent cc546389
...@@ -25,6 +25,10 @@ func ExampleMeter() { ...@@ -25,6 +25,10 @@ func ExampleMeter() {
// Get the current total. // Get the current total.
total := meter.Snapshot().Total total := meter.Snapshot().Total
fmt.Printf("%d (%d/s)\n", total, int64(math.Round(float64(rate)/10))) fmt.Printf("%d (%d/s)\n", total, roundTens(rate))
// Output: 3000 (300/s) // Output: 3000 (300/s)
} }
func roundTens(x float64) int64 {
return int64(math.Floor(x/10+0.5)) * 10
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment