Min returns the minimum duration of the schedule. This is calculated as follows: - Let t(0) be a given point in time (1970-01-01T01:01:01Z00:00) - Let t(max) be 168 hours after t(0). - Let t(1) be the next scheduled time after t(0). - Let t(n) be the next scheduled time after t(n-1). - Then, the min
()
| 210 | // - Then, the minimum duration of s d(min) |
| 211 | // = min( t(n) - t(n-1) ∀ n ∈ N, t(n) < t(max) ) |
| 212 | func (s Schedule) Min() time.Duration { |
| 213 | durMin := tMax.Sub(t0) |
| 214 | tPrev := s.Next(t0) |
| 215 | tCurr := s.Next(tPrev) |
| 216 | for { |
| 217 | dur := tCurr.Sub(tPrev) |
| 218 | if dur < durMin { |
| 219 | durMin = dur |
| 220 | } |
| 221 | tPrev = tCurr |
| 222 | tCurr = s.Next(tCurr) |
| 223 | if tCurr.After(tMax) { |
| 224 | break |
| 225 | } |
| 226 | } |
| 227 | return durMin |
| 228 | } |
| 229 | |
| 230 | // TimeParsed returns the parsed time.Time of the minute and hour fields. If the |
| 231 | // time cannot be represented in a valid time.Time, a zero time is returned. |