mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-07 02:07:58 +00:00
Re-vendor
This commit is contained in:
parent
0429028c4f
commit
ab00b207af
910 changed files with 63539 additions and 106415 deletions
4
vendor/github.com/prometheus/common/model/time.go
generated
vendored
4
vendor/github.com/prometheus/common/model/time.go
generated
vendored
|
|
@ -186,6 +186,10 @@ var durationRE = regexp.MustCompile("^([0-9]+)(y|w|d|h|m|s|ms)$")
|
|||
// ParseDuration parses a string into a time.Duration, assuming that a year
|
||||
// always has 365d, a week always has 7d, and a day always has 24h.
|
||||
func ParseDuration(durationStr string) (Duration, error) {
|
||||
// Allow 0 without a unit.
|
||||
if durationStr == "0" {
|
||||
return 0, nil
|
||||
}
|
||||
matches := durationRE.FindStringSubmatch(durationStr)
|
||||
if len(matches) != 3 {
|
||||
return 0, fmt.Errorf("not a valid duration string: %q", durationStr)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue