// AlignDuration returns the duration until next aligned interval.
// If the current time is aligned a 0 duration is returned.
558993
func AlignDuration(tm time.Time, interval time.Duration) time.Duration {
	return AlignTime(tm, interval).Sub(tm)
}
205103
func (s *Offering) SetDuration(v int64) *Offering {
	s.Duration = &v
	return s
}
220061
func (b *Build) RunDuration() (duration time.Duration, ok bool) {
	if b.StartTime.IsZero() || b.CompletionTime.IsZero() {
		return 0, false
	}
	return b.CompletionTime.Sub(b.StartTime), true
}
241897
func (s *StaticImageActivateScheduleActionSettings) SetDuration(v int64) *StaticImageActivateScheduleActionSettings {
	s.Duration = &v
	return s
}
63205
func (t *retentionTracker) CheckDuration(dur time.Duration, success bool) {
	labels := t.Labels()

	if success {
		labels["status"] = "ok"
	} else {
		labels["status"] = "error"
	}

	t.metrics.CheckDuration.With(labels).Observe(dur.Seconds())
}
607276
func (s *ReservedCacheNode) SetDuration(v int64) *ReservedCacheNode {
	s.Duration = &v
	return s
}
977795
func (s *DescribeReservedDBInstancesInput) SetDuration(v string) *DescribeReservedDBInstancesInput {
	s.Duration = &v
	return s
}
1135289
func (e *etc) ValueAsDuration(path string, dv time.Duration) time.Duration {
	value := e.valueAt(path)
	return defaulter.AsDuration(value, dv)
}
526688
func QuarterDuration(dt time.Time) time.Duration {
	start := QuarterStart(dt)
	end := NextQuarter(start)
	return end.Sub(start)
}
1255937
func (s *ApplicationMetrics) SetDuration(v int64) *ApplicationMetrics {
	s.Duration = &v
	return s
}
1285369
func (s *Client) TimingDuration(stat string, delta time.Duration, rate float32) error {
	if !s.includeStat(rate) {
		return nil
	}

	ms := float64(delta) / float64(time.Millisecond)
	return s.submit(stat, "", ms, "|ms", rate)
}
746993
func MakeDuration(target string, def int) time.Duration {
	if !elapso.MatchString(target) {
		return time.Duration(def)
	}

	matchs := elapso.FindAllStringSubmatch(target, -1)

	if len(matchs) <= 0 {
		return time.Duration(def)
	}

	match := matchs[0]

	if len(match) < 3 {
		return time.Duration(def)
	}

	dur := time.Duration(ConvertToInt(match[1], def))

	mtype := match[2]

	switch mtype {
	case "s":
		return dur * time.Second
	case "mcs":
		return dur * time.Microsecond
	case "ns":
		return dur * time.Nanosecond
	case "ms":
		return dur * time.Millisecond
	case "m":
		return dur * time.Minute
	case "h":
		return dur * time.Hour
	default:
		return time.Duration(dur) * time.Second
	}
}
1182025
func (s *DescribeOfferingOutput) SetDuration(v int64) *DescribeOfferingOutput {
	s.Duration = &v
	return s
}
672039
func (s *ReservedNodeOffering) SetDuration(v int64) *ReservedNodeOffering {
	s.Duration = &v
	return s
}
1053287
func (s *DeleteReservationOutput) SetDuration(v int64) *DeleteReservationOutput {
	s.Duration = &v
	return s
}
526822
func (s *TraceSummary) SetDuration(v float64) *TraceSummary {
	s.Duration = &v
	return s
}
1016382
func (a Arrow) AddDuration(duration string) Arrow {
	if pduration, err := time.ParseDuration(duration); err == nil {
		return a.Add(pduration)
	}
	return a
}