1package log 2 3import ( 4 "time" 5) 6 7// Clock interface provides the time. 8type clock interface { 9 Now() time.Time 10} 11 12// realClock is the default time implementation. 13type realClock struct{} 14 15// Now returns the time. 16func (realClock) Now() time.Time { return time.Now() } 17 18// stubClock is the default time implementation. 19type stubClock struct { 20 StubTime time.Time 21} 22 23// Now returns a stub time. 24func (c *stubClock) Now() time.Time { return c.StubTime } 25