You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
455 B
26 lines
455 B
3 years ago
|
package gocron
|
||
|
|
||
|
import "time"
|
||
|
|
||
|
var _ timeWrapper = (*trueTime)(nil)
|
||
|
|
||
|
type timeWrapper interface {
|
||
|
Now(*time.Location) time.Time
|
||
|
Unix(int64, int64) time.Time
|
||
|
Sleep(time.Duration)
|
||
|
}
|
||
|
|
||
|
type trueTime struct{}
|
||
|
|
||
|
func (t *trueTime) Now(location *time.Location) time.Time {
|
||
|
return time.Now().In(location)
|
||
|
}
|
||
|
|
||
|
func (t *trueTime) Unix(sec int64, nsec int64) time.Time {
|
||
|
return time.Unix(sec, nsec)
|
||
|
}
|
||
|
|
||
|
func (t *trueTime) Sleep(d time.Duration) {
|
||
|
time.Sleep(d)
|
||
|
}
|