// It is like DurationErr but panics if conversion is impossible.
356313
func (tr Row) Duration(nn int) (val time.Duration) {
	val, err := tr.DurationErr(nn)
	if err != nil {
		panic(err)
	}
	return
}
1138998
func (p *parserMixin) DurationVar(target *time.Duration) {
	p.SetValue(newDurationValue(target))
}
525585
func Duration(name string, value time.Duration, usage string) *time.Duration {
	return CommandLine.Duration(name, value, usage)
}
1197236
func Duration(max time.Duration) time.Duration {
	nbNanoseconds := 1 + int(rand.Int63n(max.Nanoseconds()))
	return time.Duration(nbNanoseconds) * time.Nanosecond
}
553866
func deltimer(t *Timer) bool {
	// Dereference t so that any panic happens before the lock is held.
	// Discard result, because t might be moving in the heap.
	_ = t.i

	timers.lock.Lock()
	// t may not be registered anymore and may have
	// a bogus i (typically 0, if generated by Go).
	// Verify it before proceeding.
	i := t.i
	last := len(timers.t) - 1
	if i < 0 || i > last || timers.t[i] != t {
		timers.lock.Unlock()
		return false
	}
	if i != last {
		timers.t[i] = timers.t[last]
		timers.t[i].i = i
	}
	timers.t[last] = nil
	timers.t = timers.t[:last]
	if i != last {
		siftupTimer(i)
		siftdownTimer(i)
	}
	timers.lock.Unlock()
	return true
}
1027905
func toSeconds(duration time.Duration) time.Duration {
	seconds := duration.Nanoseconds() / nanosecondsPerSecond
	nanoseconds := seconds * nanosecondsPerSecond
	return time.Duration(nanoseconds)
}
892596
func DurationToTS(d time.Duration) uint64 {
	return oracle.ComposeTS(d.Nanoseconds()/int64(time.Millisecond), 0)
}
911542
func mkTimer(deadline time.Duration) <-chan time.Time {

	if deadline == 0 {
		return nil
	}

	return time.After(deadline)
}
387515
func (fs *FlagSet) Duration(names []string, value time.Duration, usage string) *time.Duration {
	p := new(time.Duration)
	fs.DurationVar(p, names, value, usage)
	return p
}
533414
func (l *logger) resetTimer(d time.Duration) (expired bool) {
	expired = !l.timer.Reset(d)
	if expired {
		l.start = time.Now()
	}
	return expired
}
32959
func (_m *Statter) TimingDuration(_a0 string, _a1 time.Duration, _a2 float32) error {
	ret := _m.Called(_a0, _a1, _a2)

	var r0 error
	if rf, ok := ret.Get(0).(func(string, time.Duration, float32) error); ok {
		r0 = rf(_a0, _a1, _a2)
	} else {
		r0 = ret.Error(0)
	}

	return r0
}
265389
func resetTimer(t *time.Timer, d time.Duration) {
	t.Stop()
	// Very likely this doesn't actually work if we are already
	// selecting on t.C.  However we've stopped the original timer
	// so won't break transfers but may not time them out :-(
	*t = *time.NewTimer(d)
}
1015987
func resetTimer(t *time.Timer, d time.Duration) {
	t.Reset(d)
}
1033879
func (f *FlagSet) Duration(name string, value time.Duration, usage string) *time.Duration {
	p := new(time.Duration)
	f.DurationVar(p, name, value, usage)
	return p
}
1268189
func Duration(val interface{}) time.Duration {
	switch t := val.(type) {
	case int:
		return time.Duration(int64(t))
	case int8:
		return time.Duration(int64(t))
	case int16:
		return time.Duration(int64(t))
	case int32:
		return time.Duration(int64(t))
	case int64:
		return time.Duration(t)
	case uint:
		return time.Duration(int64(t))
	case uint8:
		return time.Duration(int64(t))
	case uint16:
		return time.Duration(int64(t))
	case uint32:
		return time.Duration(int64(t))
	case uint64:
		return time.Duration(int64(t))
	default:
		return strToDuration(String(val))
	}
	panic("Reached")
}
772389
func Duration(p *durpb.Duration) (time.Duration, error) {
	if err := validateDuration(p); err != nil {
		return 0, err
	}
	d := time.Duration(p.Seconds) * time.Second
	if int64(d/time.Second) != p.Seconds {
		return 0, fmt.Errorf("duration: %v is out of range for time.Duration", p)
	}
	if p.Nanos != 0 {
		d += time.Duration(p.Nanos) * time.Nanosecond
		if (d < 0) != (p.Nanos < 0) {
			return 0, fmt.Errorf("duration: %v is out of range for time.Duration", p)
		}
	}
	return d, nil
}
926444
func (c *config) GetTimeErr(key string, args ...interface{}) (time.Time, error) {
	val, err := c.Get(key, args...)
	if err != nil {
		return time.Time{}, err
	}
	tval, err := cfg.ToTime(val)
	c.log(TOTIME, err, toVarArgs(args, val, tval)...)
	return tval, err
}