Refactor kafka to pure Go (franz-go), fix DBC stubs, update Dockerfile
This commit is contained in:
34
pkg/can-go/internal/clock/system.go
Normal file
34
pkg/can-go/internal/clock/system.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package clock
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// System returns a Clock implementation that delegate to the time package.
|
||||
func System() Clock {
|
||||
return &systemClock{}
|
||||
}
|
||||
|
||||
type systemClock struct{}
|
||||
|
||||
var _ Clock = &systemClock{}
|
||||
|
||||
func (c systemClock) After(d time.Duration) <-chan time.Time {
|
||||
return time.After(d)
|
||||
}
|
||||
|
||||
func (c systemClock) NewTicker(d time.Duration) Ticker {
|
||||
return &systemTicker{Ticker: *time.NewTicker(d)}
|
||||
}
|
||||
|
||||
func (c systemClock) Now() time.Time {
|
||||
return time.Now()
|
||||
}
|
||||
|
||||
type systemTicker struct {
|
||||
time.Ticker
|
||||
}
|
||||
|
||||
func (t systemTicker) C() <-chan time.Time {
|
||||
return t.Ticker.C
|
||||
}
|
||||
Reference in New Issue
Block a user