go-zero/core/timex/repr.go

12 lines
249 B
Go
Raw Normal View History

2020-07-26 17:09:05 +08:00
package timex
import (
"fmt"
"time"
)
2021-02-24 16:27:11 +08:00
// ReprOfDuration returns the string representation of given duration in ms.
2020-07-26 17:09:05 +08:00
func ReprOfDuration(duration time.Duration) string {
return fmt.Sprintf("%.1fms", float32(duration)/float32(time.Millisecond))
}