util-go/benchmark/elapsed.go

13 lines
161 B
Go
Raw Permalink Normal View History

2018-09-01 03:12:54 +00:00
package benchmark
import (
"time"
)
2018-09-03 13:57:13 +00:00
func Elapsed() func() time.Duration {
2018-09-01 03:12:54 +00:00
start := time.Now()
2018-09-03 13:57:13 +00:00
return func() time.Duration {
return time.Since(start)
2018-09-01 03:12:54 +00:00
}
}