MCPcopy Create free account
hub / github.com/codnect/chrono / elapseUntil

Function elapseUntil

cron.go:383–398  ·  view source on GitHub ↗
(t time.Time, fieldType fieldType, value int)

Source from the content-addressed store, hash-verified

381}
382
383func elapseUntil(t time.Time, fieldType fieldType, value int) time.Time {
384 current := getTimeValue(t, fieldType.Field)
385
386 maxValue := getFieldMaxValue(t, fieldType)
387
388 if current >= value {
389 amount := value + maxValue - current + 1 - fieldType.MinValue
390 return addTime(t, fieldType.Field, amount)
391 }
392
393 if value >= fieldType.MinValue && value <= maxValue {
394 return with(t, fieldType.Field, value)
395 }
396
397 return addTime(t, fieldType.Field, value-current)
398}
399
400func with(t time.Time, field cronField, value int) time.Time {
401 switch field {

Callers 1

nextFieldMethod · 0.85

Calls 4

getTimeValueFunction · 0.85
getFieldMaxValueFunction · 0.85
addTimeFunction · 0.85
withFunction · 0.85

Tested by

no test coverage detected