oops, leftover file
This commit is contained in:
parent
75c3fe0bee
commit
9dce88e6c0
25
go/base/utils.go
Normal file
25
go/base/utils.go
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
Copyright 2016 GitHub Inc.
|
||||
See https://github.com/github/gh-osc/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
package base
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
prettifyDurationRegexp = regexp.MustCompile("([.][0-9]+)")
|
||||
)
|
||||
|
||||
func PrettifyDurationOutput(d time.Duration) string {
|
||||
if d < time.Second {
|
||||
return "0s"
|
||||
}
|
||||
result := fmt.Sprintf("%s", d)
|
||||
result = prettifyDurationRegexp.ReplaceAllString(result, "")
|
||||
return result
|
||||
}
|
Loading…
Reference in New Issue
Block a user