23 lines
328 B
Go
23 lines
328 B
Go
// Package timeutil provides time-zone, clock, and period helpers.
|
|
package timeutil
|
|
|
|
import "time"
|
|
|
|
type Clock interface {
|
|
Now() time.Time
|
|
}
|
|
|
|
type SystemClock struct{}
|
|
|
|
func (SystemClock) Now() time.Time {
|
|
return time.Now()
|
|
}
|
|
|
|
type FixedClock struct {
|
|
Time time.Time
|
|
}
|
|
|
|
func (c FixedClock) Now() time.Time {
|
|
return c.Time
|
|
}
|