(field *cronFieldBits, t time.Time)
| 124 | } |
| 125 | |
| 126 | func (expression *CronExpression) nextField(field *cronFieldBits, t time.Time) time.Time { |
| 127 | current := getTimeValue(t, field.Typ.Field) |
| 128 | next := setNextBit(field.Bits, current) |
| 129 | |
| 130 | if next == -1 { |
| 131 | amount := getFieldMaxValue(t, field.Typ) - current + 1 |
| 132 | t = addTime(t, field.Typ.Field, amount) |
| 133 | next = setNextBit(field.Bits, 0) |
| 134 | } |
| 135 | |
| 136 | if next == current { |
| 137 | return t |
| 138 | } else { |
| 139 | count := 0 |
| 140 | current := getTimeValue(t, field.Typ.Field) |
| 141 | for ; current != next && count < maxAttempts; count++ { |
| 142 | t = elapseUntil(t, field.Typ, next) |
| 143 | current = getTimeValue(t, field.Typ.Field) |
| 144 | } |
| 145 | |
| 146 | if count >= maxAttempts { |
| 147 | return time.Time{} |
| 148 | } |
| 149 | |
| 150 | return t |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | func ParseCronExpression(expression string) (*CronExpression, error) { |
| 155 | if len(expression) == 0 { |
no test coverage detected