move congestion clock to new file and implement default clock

This commit is contained in:
Lucas Clemente
2016-04-28 21:53:47 +02:00
parent ac1affb940
commit 34b2e5129c
2 changed files with 18 additions and 5 deletions

18
congestion/clock.go Normal file
View File

@@ -0,0 +1,18 @@
package congestion
import "time"
// A Clock returns the current time
type Clock interface {
Now() time.Time
}
// DefaultClock implements the Clock interface using the Go stdlib clock.
type DefaultClock struct{}
var _ Clock = DefaultClock{}
// Now gets the current time
func (DefaultClock) Now() time.Time {
return time.Now()
}

View File

@@ -7,11 +7,6 @@ import (
"github.com/lucas-clemente/quic-go/protocol"
)
// A Clock returns the current time
type Clock interface {
Now() time.Time
}
// This cubic implementation is based on the one found in Chromiums's QUIC
// implementation, in the files net/quic/congestion_control/cubic.{hh,cc}.