We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6ad620d commit 8cfd121Copy full SHA for 8cfd121
common/format.go
@@ -27,12 +27,12 @@ import (
27
// the unnecessary precision off from the formatted textual representation.
28
type PrettyDuration time.Duration
29
30
-var prettyDurationRe = regexp.MustCompile(`\.[0-9]+`)
+var prettyDurationRe = regexp.MustCompile(`\.[0-9]{4,}`)
31
32
// String implements the Stringer interface, allowing pretty printing of duration
33
// values rounded to three decimals.
34
func (d PrettyDuration) String() string {
35
- label := fmt.Sprintf("%v", time.Duration(d))
+ label := time.Duration(d).String()
36
if match := prettyDurationRe.FindString(label); len(match) > 4 {
37
label = strings.Replace(label, match, match[:4], 1)
38
}
0 commit comments