// GetDuration retrievses the value for key from the environment, or the
// supplied configuration data, returning it as a time.Duration.
179058
func (ec *Envcfg) GetDuration(key string) time.Duration {
	d, _ := time.ParseDuration(ec.GetKey(key))
	return d
}
1016382
func (a Arrow) AddDuration(duration string) Arrow {
	if pduration, err := time.ParseDuration(duration); err == nil {
		return a.Add(pduration)
	}
	return a
}
306707
func NewDuration(vals ...V) DurationA {
	a := &arg{}

	d := Default.Get(vals)
	a.defv = d

	f := A(flagA).Get(vals)
	if f != nil {
		f := f.(flagT)
		a.defv = flag.Duration(f.name, f.defv.(time.Duration), f.usage)
	}

	ad := a.getA()
	return func(d time.Duration) V {
		return ad(d)
	}
}
446913
func GetDurationOrDefault(key string, defVal time.Duration) time.Duration {
	viperLock.RLock()
	defer viperLock.RUnlock()

	if val := viper.GetDuration(key); val != 0 {
		return val
	}

	return defVal
}
460308
func GetDurationField(r *http.Request, fieldName string) (time.Duration, error) {
	s, err := GetStringField(r, fieldName)
	if err != nil {
		return 0, err
	}
	d, err := time.ParseDuration(s)
	if err != nil || d < 0 {
		return 0, InvalidFormatError{fieldName, s}
	}
	return d, nil
}
1372820
func (h *Histogram) RecordDuration(v time.Duration) error {
	return h.RecordIntScale(int64(v), -9)
}
79533
func (m *TimerMetrics) StatusDuration(duration time.Duration) {
	if m.statusEvery == 0 {
		return
	}

	m.Lock()
	m.position++
	var looped bool
	if m.position > m.statusEvery {
		// loop back around
		looped = true
		m.position = 1
	}
	if m.position > len(m.timings) {
		m.timings = append(m.timings, duration)
	} else {
		m.timings[m.position-1] = duration
	}

	if !looped {
		m.Unlock()
		return
	}

	stats := m.getStats()
	m.Unlock()

	log.Printf("%s", stats)
}
175574
func (s *promScope) TimingDuration(stat string, delta time.Duration) {
	s.autoSummary(s.statName(stat) + "_seconds").Observe(delta.Seconds())
}
1351046
func (c *config) GetTime(key string, args ...interface{}) time.Time {
	val, err := c.GetTimeErr(key, args...)
	if err != nil {
		c.errorHandler(key, err, args...)
	}
	return val
}
1191700
func safeDuration(dur string, defaultDur time.Duration) time.Duration {
	d, err := time.ParseDuration(dur)
	if err != nil {
		log.Printf("Invalid duration '%s', using default of %s", dur, defaultDur)
		return defaultDur
	}
	return d
}
1327531
func getDurationEnvVar(envVar string, def *time.Duration) *time.Duration {
	if strVal := os.Getenv(envVar); strVal != "" {
		if dur, err := time.ParseDuration(strVal); err == nil {
			return &dur
		}
	}
	return def
}
1182025
func (s *DescribeOfferingOutput) SetDuration(v int64) *DescribeOfferingOutput {
	s.Duration = &v
	return s
}
299511
func (s Storage) expirationDuration(c context.Context) time.Duration {
	if info.IsDevAppServer(c) {
		return time.Second
	}
	return time.Minute
}
13897
func (s *LoggingStatter) SafeTimingDuration(stat string, delta time.Duration, rate float32) {
	if err := s.TimingDuration(stat, delta, rate); err != nil {
		logger.WithError(err).Errorf("Error sending stat %s TimingDuration to statsd", stat)
	}
}
1036288
func (s *DescribeReservedCacheNodesOfferingsInput) SetDuration(v string) *DescribeReservedCacheNodesOfferingsInput {
	s.Duration = &v
	return s
}
1212143
func (c *Config) GetDuration(s string) time.Duration {
	return c.config.GetDuration(s)
}
508239
func NewDuration(s string) (duration, error) {
	var e duration
	err := e.FromString(s)
	if err != nil {
		return 0, err
	}
	return e, nil
}