go-zero/core/timex/repr.go
2021-02-24 16:27:11 +08:00

12 lines
249 B
Go

package timex
import (
"fmt"
"time"
)
// ReprOfDuration returns the string representation of given duration in ms.
func ReprOfDuration(duration time.Duration) string {
return fmt.Sprintf("%.1fms", float32(duration)/float32(time.Millisecond))
}