修改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)
crontab := "f2|f2?3|f3?4|1|t4?5"
crontab := "f2|f2>3|f3>4|1|s4>5"
cron := NewCrontab(crontab)
i := 0

View File

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