Cloak/internal/common/worldstate.go

25 lines
325 B
Go
Raw Normal View History

2020-04-09 21:11:12 +00:00
package common
import (
"crypto/rand"
"io"
"time"
)
var RealWorldState = WorldState{
Rand: rand.Reader,
Now: time.Now,
}
type WorldState struct {
Rand io.Reader
Now func() time.Time
}
2020-04-09 21:21:02 +00:00
func WorldOfTime(t time.Time) WorldState {
return WorldState{
Rand: rand.Reader,
Now: func() time.Time { return t },
}
}