This commit is contained in:
eson 2018-12-07 04:42:53 +08:00
parent f3702f9df0
commit 316d616419
2 changed files with 6 additions and 6 deletions

View File

@ -109,16 +109,16 @@ func (cron *Crontab) TimeUp() bool {
}
// NextTime 返回下次任务的时间
func (cron *Crontab) NextTime() *time.Time {
func (cron *Crontab) NextTime() time.Time {
if cron.interval != nil {
return &cron.nextTime
return cron.nextTime
}
if len(cron.WillPlans) > 0 {
return &cron.WillPlans[0]
return cron.WillPlans[0]
}
return nil
return time.Now().Add(time.Second * 2)
}
func (cron *Crontab) String() string {

View File

@ -26,8 +26,8 @@ func TestParseCrontab(t *testing.T) {
}
cron.createYearPlan()
if !cron.TimeUp() {
t.Error("timeup error")
if cron.TimeUp() {
t.Error("timeup error", cron.WillPlans[0:2])
}
PrintMemUsage()