1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
package shared

import "time"

// Clock is where the feed follower gets the time from and waits on, so that
// tests can run weeks of polling against a simulated clock in milliseconds.
type Clock interface {
	Now() time.Time
	Sleep(d time.Duration)
}

// RealClock is the wall clock.
type RealClock struct{}

func (RealClock) Now() time.Time        { return time.Now() }
func (RealClock) Sleep(d time.Duration) { time.Sleep(d) }