MCPcopy Create free account
hub / github.com/cloudbase/garm / ParseDuration

Method ParseDuration

config/config.go:680–686  ·  view source on GitHub ↗

ParseDuration parses the configured duration and returns a time.Duration of 0 if the duration is invalid.

()

Source from the content-addressed store, hash-verified

678// ParseDuration parses the configured duration and returns a time.Duration of 0
679// if the duration is invalid.
680func (m *Metrics) ParseDuration() (time.Duration, error) {
681 duration, err := time.ParseDuration(fmt.Sprint(m.Period))
682 if err != nil {
683 return 0, err
684 }
685 return duration, nil
686}
687
688// Duration returns the configured duration or the default duration if no value
689// is configured or the configured value is invalid.

Callers 5

DurationMethod · 0.95
TestTimeToLiveDurationFunction · 0.45
ParseDurationMethod · 0.45
UnmarshalTextMethod · 0.45
ValidateMethod · 0.45

Calls

no outgoing calls

Tested by 1

TestTimeToLiveDurationFunction · 0.36