Mock time (#2)

This commit is contained in:
Jonas Plum
2021-12-27 00:17:44 +01:00
committed by GitHub
parent 0286574692
commit 1fade14ba5
19 changed files with 916 additions and 969 deletions

19
time/time.go Normal file
View File

@@ -0,0 +1,19 @@
package time
import "time"
type Clock interface {
Now() time.Time
}
type realClock struct{}
func (realClock) Now() time.Time {
return time.Now()
}
var DefaultClock Clock = &realClock{}
func Now() time.Time {
return DefaultClock.Now()
}