diff --git a/crontab.go b/crontab.go index 1fe63c6..5150c9d 100644 --- a/crontab.go +++ b/crontab.go @@ -146,7 +146,7 @@ func (cron *Crontab) FromString(crontab string) error { var intervalList []interface{} intervalList = parseIntervalString(matches[0]) cron.interval.Append(intervalList...) - cron.TimeUp() + cron.NextTime() case 5: cron.min = createTimePointer(matches[0], 0, 59, true) cron.hour = createTimePointer(matches[1], 0, 23, true) @@ -155,7 +155,7 @@ func (cron *Crontab) FromString(crontab string) error { cron.week = createTimePointer(matches[4], 0, 6, true) cron.createYearPlan() - cron.TimeUp() + cron.NextTime() default: return errors.New("mathches len != want, check crontab string") } diff --git a/crontab_test.go b/crontab_test.go index 190d1d7..97f9586 100644 --- a/crontab_test.go +++ b/crontab_test.go @@ -66,6 +66,10 @@ func isInRangeTime(sec, t float64) error { return fmt.Errorf("计算错误 范围 %f-%f interval time is %f", t-0.05, t+0.05, sec) } +func TestParseIntervalOnline1(t *testing.T) { + +} + func TestParseIntervalPlus(t *testing.T) { // crontab := "0-5/2,7-30/3,30,35,40-^1 * * * *" //(秒) 分 时 号(每月的多少号, 要注意月可可能性) 星期几(每个星期的) /每 ,列表 -范围 // crondata := NewCrontab("*22 * * * *")