mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2025-12-08 00:02:49 +01:00
Mock time (#2)
This commit is contained in:
19
time/time.go
Normal file
19
time/time.go
Normal 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()
|
||||
}
|
||||
Reference in New Issue
Block a user