// NewDuration returns returns an 'enum' value of type duration given its
// string representation
508239
func NewDuration(s string) (duration, error) {
	var e duration
	err := e.FromString(s)
	if err != nil {
		return 0, err
	}
	return e, nil
}
977795
func (s *DescribeReservedDBInstancesInput) SetDuration(v string) *DescribeReservedDBInstancesInput {
	s.Duration = &v
	return s
}
1352721
func (s *NoopClient) TimingDuration(stat string, delta time.Duration, rate float32) error {
	return nil
}
1254155
func NewDuration(name string) *Duration {
	v := new(Duration)
	Publish(name, v)
	return v
}
825098
func Duration(d time.Duration) string {
	var s string
	if d >= yearDuration {
		years := d / yearDuration
		s += fmt.Sprintf("%dy", years)
		d -= (years * yearDuration)
	}

	if d >= dayDuration {
		days := d / dayDuration
		s += fmt.Sprintf("%dd", days)
	}

	if s != "" {
		return s
	}

	d %= 1 * time.Second
	hours := d / time.Hour
	d -= (hours * time.Hour)
	s += fmt.Sprintf("%dh%s", hours, d)
	return s
}
1016382
func (a Arrow) AddDuration(duration string) Arrow {
	if pduration, err := time.ParseDuration(duration); err == nil {
		return a.Add(pduration)
	}
	return a
}
601536
func randDuration(n time.Duration) time.Duration {
	return time.Duration(rand.Int63n(int64(n)))
}
417668
func (d Duration) Duration() (time.Duration, error) {
	switch {
	case byte(d) == 0x00:
		return time.Duration(0), nil
	case byte(d) <= 0x7F:
		return time.Duration(d) * time.Second, nil
	case d <= 0xFD:
		return time.Duration(d-0x7F) * time.Minute, nil
	}
	return time.Duration(0), fmt.Errorf("Factory default duration")
}
486480
func allowedDuration(duration time.Duration) bool {
	if duration < time.Second {
		return false
	}
	return duration <= time.Minute
}
98404
func (s *DescribeReservedDBInstancesOfferingsInput) SetDuration(v string) *DescribeReservedDBInstancesOfferingsInput {
	s.Duration = &v
	return s
}
295928
func ToNormalizedDuration(d time.Duration, u time.Duration) int64 {
	return int64(d / u)
}
672039
func (s *ReservedNodeOffering) SetDuration(v int64) *ReservedNodeOffering {
	s.Duration = &v
	return s
}
378994
func (r *Definition) TimeoutDuration() time.Duration {
	return time.Duration(r.Timeout) * time.Millisecond
}
526822
func (s *TraceSummary) SetDuration(v float64) *TraceSummary {
	s.Duration = &v
	return s
}
326178
func (s *ReservedCacheNodesOffering) SetDuration(v int64) *ReservedCacheNodesOffering {
	s.Duration = &v
	return s
}
1352094
func (b *builtinAddDurationAndStringSig) evalDuration(row chunk.Row) (types.Duration, bool, error) {
	arg0, isNull, err := b.args[0].EvalDuration(b.ctx, row)
	if isNull || err != nil {
		return types.ZeroDuration, isNull, err
	}
	s, isNull, err := b.args[1].EvalString(b.ctx, row)
	if isNull || err != nil {
		return types.ZeroDuration, isNull, err
	}
	if !isDuration(s) {
		return types.ZeroDuration, true, nil
	}
	arg1, err := types.ParseDuration(b.ctx.GetSessionVars().StmtCtx, s, types.GetFsp(s))
	if err != nil {
		return types.ZeroDuration, true, err
	}
	result, err := arg0.Add(arg1)
	if err != nil {
		return types.ZeroDuration, true, err
	}
	return result, false, nil
}
1053287
func (s *DeleteReservationOutput) SetDuration(v int64) *DeleteReservationOutput {
	s.Duration = &v
	return s
}