Commit 665adb1b authored by Sebastian Stark's avatar Sebastian Stark

move clock related code into clock.go

parent 386c9d4e
......@@ -18,3 +18,20 @@ type realClock struct{}
func (realClock) Now() time.Time {
return time.Now()
}
type skewClock struct {
skew time.Duration
}
func (cl *skewClock) Now() time.Time {
return time.Now().Add(-cl.skew)
}
func newSkewClock(i int64) *skewClock {
d := time.Now().Sub(time.Unix(i, 0))
return &skewClock{skew: d}
}
func (cl *skewClock) forward(d time.Duration) {
cl.skew -= d
}
......@@ -27,23 +27,6 @@ var mockSnapshots = []string{
"1400337721-1400337722-complete",
}
type skewClock struct {
skew time.Duration
}
func (cl *skewClock) Now() time.Time {
return time.Now().Add(-cl.skew)
}
func newSkewClock(i int64) *skewClock {
d := time.Now().Sub(time.Unix(i, 0))
return &skewClock{skew: d}
}
func (cl *skewClock) forward(d time.Duration) {
cl.skew -= d
}
func mockConfig() {
tmpRepository, err := ioutil.TempDir("", "snaprd_testing")
if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment