// Duration returns the length of the current track.
492062
func (t *Track) Duration() time.Duration {
	ms := C.sp_track_duration(t.sp_track)
	return time.Duration(ms) * time.Millisecond
}
827040
func DurationFromUnit(u Unit) (time.Duration, error) {
	if duration, found := unitsToDuration[u]; found {
		return duration, nil
	}

	return 0, errConvertUnitToDuration
}
558944
func (t *Tracker) Window() time.Duration {
	t.RLock()
	defer t.RUnlock()

	return t.timeout - time.Since(t.last)
}
1297126
func (ta *TrackAttributes) TargetDuration(duration int) *TrackAttributes {
	ta.intAttributes["target_duration_ms"] = duration
	return ta
}
268651
func (s *sender) Timing(stat string, duration time.Duration, tags ...string) {
	s.Gauge(stat, float64(duration/time.Millisecond), tags...)
}
397419
func (b *Backoff) duration(n uint64) (t time.Duration) {
	// Saturate pow
	pow := time.Duration(math.MaxInt64)
	if n < 63 {
		pow = 1 << n
	}

	t = b.interval * pow
	if t/pow != b.interval || t > b.maxDuration {
		t = b.maxDuration
	}

	return
}
175574
func (s *promScope) TimingDuration(stat string, delta time.Duration) {
	s.autoSummary(s.statName(stat) + "_seconds").Observe(delta.Seconds())
}
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
}
1021563
func (t *Timedelta) Duration() time.Duration {
	return t.Days*24*time.Hour +
		t.Seconds*time.Second +
		t.Microseconds*time.Microsecond +
		t.Milliseconds*time.Millisecond +
		t.Minutes*time.Minute +
		t.Hours*time.Hour +
		t.Weeks*7*24*time.Hour
}
377912
func (p *parserMixin) Duration() (target *time.Duration) {
	target = new(time.Duration)
	p.DurationVar(target)
	return
}
1372820
func (h *Histogram) RecordDuration(v time.Duration) error {
	return h.RecordIntScale(int64(v), -9)
}
666655
func (t UnixTime) Duration() time.Duration {
	return time.Time(t).Sub(unixEpoch)
}
616128
func (t ntpTime) Duration() time.Duration {
	sec := (t >> 32) * nanoPerSec
	frac := (t & 0xffffffff) * nanoPerSec >> 32
	return time.Duration(sec + frac)
}
1100373
func (s *Sample) Duration() time.Duration {
	return s.End.Sub(s.Start)
}
1139405
func (b *Backoff) Duration() time.Duration {
	b.setup()

	b.decayN()

	t := b.duration(b.n)

	if b.n < math.MaxUint64 {
		b.n++
	}

	if !b.noJitter {
		prngMu.Lock()
		t = time.Duration(prng.Int63n(int64(t)))
		prngMu.Unlock()
	}

	return t
}
1197236
func Duration(max time.Duration) time.Duration {
	nbNanoseconds := 1 + int(rand.Int63n(max.Nanoseconds()))
	return time.Duration(nbNanoseconds) * time.Nanosecond
}
1277730
func Duration(name rune, value time.Duration, helpvalue ...string) *time.Duration {
	CommandLine.FlagLong(&value, "", name, helpvalue...)
	return &value
}