// FromNormalizedDuration returns the duration given the normalized time duration and a time unit.
488181
func FromNormalizedDuration(nd int64, u time.Duration) time.Duration {
	return time.Duration(nd) * u
}
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
}
404779
func (t *TimePeriod) Normalize() error {
	if t.GetDuration() == "" {
		return nil
	}
	n, err := t.Time.(*TimePeriod_Duration).ToSeconds()
	if err != nil {
		return errors.Annotate(err, "invalid duration").Err()
	}
	t.Time = &TimePeriod_Seconds{
		Seconds: n,
	}
	return nil
}
736339
func (t *SimpleTrack) TimeDuration() time.Duration {
	return time.Duration(t.Duration) * time.Millisecond
}
863551
func (s *ReservedElasticsearchInstance) SetDuration(v int64) *ReservedElasticsearchInstance {
	s.Duration = &v
	return s
}
378994
func (r *Definition) TimeoutDuration() time.Duration {
	return time.Duration(r.Timeout) * time.Millisecond
}
506005
func FiletimeToDuration(ft *syscall.Filetime) time.Duration {
	n := int64(ft.HighDateTime)<<32 + int64(ft.LowDateTime) // in 100-nanosecond intervals
	return time.Duration(n * 100)
}
1345641
func (s *JobOutput) SetDurationMillis(v int64) *JobOutput {
	s.DurationMillis = &v
	return s
}
834820
func (s *ClusterSummary) SetNormalizedInstanceHours(v int64) *ClusterSummary {
	s.NormalizedInstanceHours = &v
	return s
}
1255937
func (s *ApplicationMetrics) SetDuration(v int64) *ApplicationMetrics {
	s.Duration = &v
	return s
}
1282933
func (s *UpdateMaintenanceWindowOutput) SetDuration(v int64) *UpdateMaintenanceWindowOutput {
	s.Duration = &v
	return s
}
410036
func RandomDuration(max time.Duration) time.Duration {
	randomVal, err := rand.Int(rand.Reader, big.NewInt(int64(max)))
	if err != nil {
		return max / 2
	}
	return time.Duration(randomVal.Int64())
}
867490
func (c *Context) GlobalDuration(name string) time.Duration {
	return lookupDuration(name, c.globalSet)
}
662347
func formatDuration(duration time.Duration) string {
	// We're not supporting negative durations
	if duration.Seconds() <= 0 {
		return "PT0S"
	}

	h := int(duration.Hours())
	m := int(duration.Minutes()) - (h * 60)
	s := int(duration.Seconds()) - (h*3600 + m*60)

	res := "PT"
	if h > 0 {
		res = fmt.Sprintf("%s%dH", res, h)
	}
	if m > 0 {
		res = fmt.Sprintf("%s%dM", res, m)
	}
	if s > 0 {
		res = fmt.Sprintf("%s%dS", res, s)
	}

	return res
}
545665
func (s *Session) SetDuration(v int64) *Session {
	s.Duration = &v
	return s
}
418105
func ToNormalizedTime(t time.Time, u time.Duration) int64 {
	return t.UnixNano() / u.Nanoseconds()
}