forked from quic-go/quic-go
implement a memory-optimized time.Time replacement (#5334)
* implement a memory-optimized time.Time replacement * monotime: properly handle systems with bad timer resolution (Windows) * monotime: simplify Since
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
package congestion
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"github.com/quic-go/quic-go/internal/monotime"
|
||||
)
|
||||
|
||||
// A Clock returns the current time
|
||||
type Clock interface {
|
||||
Now() time.Time
|
||||
Now() monotime.Time
|
||||
}
|
||||
|
||||
// DefaultClock implements the Clock interface using the Go stdlib clock.
|
||||
@@ -13,6 +15,6 @@ type DefaultClock struct{}
|
||||
var _ Clock = DefaultClock{}
|
||||
|
||||
// Now gets the current time
|
||||
func (DefaultClock) Now() time.Time {
|
||||
return time.Now()
|
||||
func (DefaultClock) Now() monotime.Time {
|
||||
return monotime.Now()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user