timer.go

 1// Copyright 2024 The Go Authors. All rights reserved.
 2// Use of this source code is governed by a BSD-style
 3// license that can be found in the LICENSE file.
 4package http2
 5
 6import "time"
 7
 8// A timer is a time.Timer, as an interface which can be replaced in tests.
 9type timer = interface {
10	C() <-chan time.Time
11	Reset(d time.Duration) bool
12	Stop() bool
13}
14
15// timeTimer adapts a time.Timer to the timer interface.
16type timeTimer struct {
17	*time.Timer
18}
19
20func (t timeTimer) C() <-chan time.Time { return t.Timer.C }