mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
project: use vndr for vendoring
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
parent
f54339dfea
commit
f2614f2107
2107 changed files with 99972 additions and 26271 deletions
42
vendor/github.com/pivotal-golang/clock/clock.go
generated
vendored
Normal file
42
vendor/github.com/pivotal-golang/clock/clock.go
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
package clock
|
||||
|
||||
import "time"
|
||||
|
||||
type Clock interface {
|
||||
Now() time.Time
|
||||
Sleep(d time.Duration)
|
||||
Since(t time.Time) time.Duration
|
||||
|
||||
NewTimer(d time.Duration) Timer
|
||||
NewTicker(d time.Duration) Ticker
|
||||
}
|
||||
|
||||
type realClock struct{}
|
||||
|
||||
func NewClock() Clock {
|
||||
return &realClock{}
|
||||
}
|
||||
|
||||
func (clock *realClock) Now() time.Time {
|
||||
return time.Now()
|
||||
}
|
||||
|
||||
func (clock *realClock) Since(t time.Time) time.Duration {
|
||||
return time.Now().Sub(t)
|
||||
}
|
||||
|
||||
func (clock *realClock) Sleep(d time.Duration) {
|
||||
<-clock.NewTimer(d).C()
|
||||
}
|
||||
|
||||
func (clock *realClock) NewTimer(d time.Duration) Timer {
|
||||
return &realTimer{
|
||||
t: time.NewTimer(d),
|
||||
}
|
||||
}
|
||||
|
||||
func (clock *realClock) NewTicker(d time.Duration) Ticker {
|
||||
return &realTicker{
|
||||
t: time.NewTicker(d),
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue