// timerReset safely reset a timer, see time.Timer.Reset for details.
512789
func timerReset(t *time.Timer, d time.Duration) {
	if !t.Stop() {
		<-t.C
	}
	t.Reset(d)
}
301588
func (e *eventTimestamper) Reset() {
	e.lock.Lock()
	e.timestamp = time.Now()
	e.lock.Unlock()
}
888079
func (fc *FakeClock) Timer(d time.Duration) Timer {
	return fc.FakeTimer(d)
}
517553
func (a *aggregator) resetNotifyTimer(duration time.Duration) {
	l.Debugln(a, "Resetting notifyTimer to", duration.String())
	a.notifyTimerNeedsReset = false
	a.notifyTimer.Reset(duration)
}
563455
func Reset() {
	var d net.Dialer
	OverrideDial(d.DialContext)
	OverrideResolve(net.ResolveTCPAddr)
	OverrideListenUDP(func(network string, laddr *net.UDPAddr) (net.PacketConn, error) {
		return net.ListenUDP(network, laddr)
	})
	OverrideDialUDP(func(network string, laddr, raddr *net.UDPAddr) (net.PacketConn, error) {
		return net.DialUDP(network, laddr, raddr)
	})
}
1265717
func (t *Tracker) Reset() {
	t.Lock()
	defer t.Unlock()

	t.last = time.Now()
}
478783
func (ps *peerSet) Reset() {
	ps.lock.RLock()
	defer ps.lock.RUnlock()

	for _, peer := range ps.peers {
		peer.Reset()
	}
}
132140
func (h *nodeHeartbeater) resetHeartbeatTimerLocked(id string, ttl time.Duration) {
	// Ensure a timer map exists
	if h.heartbeatTimers == nil {
		h.heartbeatTimers = make(map[string]*time.Timer)
	}

	// Renew the heartbeat timer if it exists
	if timer, ok := h.heartbeatTimers[id]; ok {
		timer.Reset(ttl)
		return
	}

	// Create a new timer to track expiration of this heartbeat
	timer := time.AfterFunc(ttl, func() {
		h.invalidateHeartbeat(id)
	})
	h.heartbeatTimers[id] = timer
}
351033
func (o *Once) Reset() {
	o.m.Lock()
	defer o.m.Unlock()
	atomic.StoreUint32(&o.done, 0)
}
8643
func (l *Logger) Timer() *Log {
	return &Log{
		Package: l.Name,
		Level:   "TIMER",
		Time:    Now(),
	}
}
1328719
func (c *Context) reset() {
	c.Writer = &c.writermem
	c.Params = c.Params[0:0]
	c.handlers = nil
	c.index = -1
	c.Keys = nil
	c.Errors = c.Errors[0:0]
	c.Accepted = nil
}
1333863
func (ns *NamedStopwatch) Reset(name string) {
	if ns == nil {
		return // if we're not using stopwatches we just do nothing
	}
	ns.Lock()
	defer ns.Unlock()

	if ns == nil {
		return
	}
	if s, ok := ns.stopwatches[name]; ok {
		s.Reset()
	}
}
1194099
func (s *Server) resetSessionTimer(id string, session *structs.Session) error {
	// Fault the session in if not given
	if session == nil {
		state := s.fsm.State()
		_, s, err := state.SessionGet(nil, id)
		if err != nil {
			return err
		}
		if s == nil {
			return fmt.Errorf("Session '%s' not found", id)
		}
		session = s
	}

	// Bail if the session has no TTL, fast-path some common inputs
	switch session.TTL {
	case "", "0", "0s", "0m", "0h":
		return nil
	}

	// Parse the TTL, and skip if zero time
	ttl, err := time.ParseDuration(session.TTL)
	if err != nil {
		return fmt.Errorf("Invalid Session TTL '%s': %v", session.TTL, err)
	}
	if ttl == 0 {
		return nil
	}

	s.createSessionTimer(session.ID, ttl)
	return nil
}
406946
func (tm *Timer) SetInterval(ns time.Duration) {
	tm.interval.Set(ns)
	tm.mu.Lock()
	defer tm.mu.Unlock()
	if tm.running {
		tm.msg <- timerReset
	}
}
137670
func (r *Range) Reset() {
	r.Min, r.Max = 0, 0
	r.TMin, r.TMax = time.Time{}, time.Time{}
	r.Tics = nil
	r.Norm, r.InvNorm = nil, nil
	r.Data2Screen, r.Screen2Data = nil, nil

	if !r.TicSetting.UserDelta {
		r.TicSetting.Delta = 0
		r.TicSetting.TDelta = nil
	}
}
1244838
func (m *Mock) Timer(d time.Duration) *Timer {
	m.mu.Lock()
	defer m.mu.Unlock()
	ch := make(chan time.Time, 1)
	t := &Timer{
		C:       ch,
		c:       ch,
		mock:    m,
		next:    m.now.Add(d),
		stopped: false,
	}
	m.timers = append(m.timers, (*internalTimer)(t))
	return t
}
972649
func (t *StandardResettingTimer) Time(f func()) {
	ts := time.Now()
	f()
	t.Update(time.Since(ts))
}