// fromDuration converts a time in nanosecond to time in µs.
973940
func fromDuration(t time.Duration) microseconds {
	return microseconds(float64(t) / float64(time.Microsecond))
}
655292
func (ta *TrackAttributes) MaxDuration(duration int) *TrackAttributes {
	ta.intAttributes["max_duration_ms"] = duration
	return ta
}
384528
func (s *DescribeEventsInput) SetDuration(v int64) *DescribeEventsInput {
	s.Duration = &v
	return s
}
1246625
func FromNormalizedTime(nt int64, u time.Duration) time.Time {
	return time.Unix(0, int64(u/time.Nanosecond)*nt)
}
1297126
func (ta *TrackAttributes) TargetDuration(duration int) *TrackAttributes {
	ta.intAttributes["target_duration_ms"] = duration
	return ta
}
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)
}
107521
func RandomDuration(max time.Duration) time.Duration {
	if max == 0 {
		return 0
	}

	var sleepns int64
	maxSleep := big.NewInt(max.Nanoseconds())
	if j, err := rand.Int(rand.Reader, maxSleep); err == nil {
		sleepns = j.Int64()
	}

	return time.Duration(sleepns)
}
1008102
func MaxDuration(a, b time.Duration) time.Duration {
	if a > b {
		return a
	}
	return b
}
1349402
func (l *ListDuration) AddDuration(d time.Duration) {
	l.Duration = l.Duration + d
	l.TimesInList++
}
73336
func (s *Deployment) SetDuration(v int64) *Deployment {
	s.Duration = &v
	return s
}
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)
}
299511
func (s Storage) expirationDuration(c context.Context) time.Duration {
	if info.IsDevAppServer(c) {
		return time.Second
	}
	return time.Minute
}
1087115
func NewDuration(d time.Duration) *Duration {
	return &Duration{v: *NewInt64(int64(d))}
}
122495
func (d *DefaultMetricCollector) RunDuration() *rolling.Timing {
	d.mutex.RLock()
	defer d.mutex.RUnlock()
	return d.runDuration
}
587431
func (a *SynthesizeTapGestureArgs) SetDuration(duration int) *SynthesizeTapGestureArgs {
	a.Duration = &duration
	return a
}
977795
func (s *DescribeReservedDBInstancesInput) SetDuration(v string) *DescribeReservedDBInstancesInput {
	s.Duration = &v
	return s
}
1027905
func toSeconds(duration time.Duration) time.Duration {
	seconds := duration.Nanoseconds() / nanosecondsPerSecond
	nanoseconds := seconds * nanosecondsPerSecond
	return time.Duration(nanoseconds)
}