修改crontab控制的表达式字符 前缀 t, T -> s, S 代表Success, '?' -> '>' 代表 大于等于

This commit is contained in:
eson 2018-12-22 03:42:38 +08:00
parent f8e7d16241
commit ed4ddb00ed
2 changed files with 6 additions and 6 deletions

View File

@ -79,7 +79,7 @@ func TestParseIntervalPlus(t *testing.T) {
log.SetFlags(log.Llongfile) log.SetFlags(log.Llongfile)
crontab := "f2|f2?3|f3?4|1|t4?5" crontab := "f2|f2>3|f3>4|1|s4>5"
cron := NewCrontab(crontab) cron := NewCrontab(crontab)
i := 0 i := 0

View File

@ -73,7 +73,7 @@ func parseIntervalString(crontab string) []interface{} {
switch FN[0] { switch FN[0] {
case 'f', 'F': case 'f', 'F':
scharIndex := strings.Index(FN, "?") scharIndex := strings.Index(FN, ">")
if scharIndex != -1 { if scharIndex != -1 {
fc := FN[0:scharIndex] fc := FN[0:scharIndex]
@ -89,8 +89,8 @@ func parseIntervalString(crontab string) []interface{} {
interval.PlanFail = append(interval.PlanFail, parseRandLR(fvalue)) interval.PlanFail = append(interval.PlanFail, parseRandLR(fvalue))
} }
case 't', 'T': case 's', 'S':
scharIndex := strings.Index(FN, "?") scharIndex := strings.Index(FN, ">")
if scharIndex != -1 { if scharIndex != -1 {
tc := FN[0:scharIndex] tc := FN[0:scharIndex]
tlr := FN[scharIndex+1:] tlr := FN[scharIndex+1:]
@ -106,8 +106,8 @@ func parseIntervalString(crontab string) []interface{} {
} }
default: default:
FN = "t" + FN FN = "s" + FN
scharIndex := strings.Index(FN, "?") scharIndex := strings.Index(FN, ">")
if scharIndex != -1 { if scharIndex != -1 {
tc := FN[0:scharIndex] tc := FN[0:scharIndex]
tlr := FN[scharIndex+1:] tlr := FN[scharIndex+1:]