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

Function getTimeValue

cron.go:327–350  ·  view source on GitHub ↗
(t time.Time, field cronField)

Source from the content-addressed store, hash-verified

325}
326
327func getTimeValue(t time.Time, field cronField) int {
328
329 switch field {
330 case cronFieldNanoSecond:
331 return t.Nanosecond()
332 case cronFieldSecond:
333 return t.Second()
334 case cronFieldMinute:
335 return t.Minute()
336 case cronFieldHour:
337 return t.Hour()
338 case cronFieldDayOfMonth:
339 return t.Day()
340 case cronFieldMonth:
341 return int(t.Month())
342 case cronFieldDayOfWeek:
343 if t.Weekday() == 0 {
344 return 7
345 }
346 return int(t.Weekday())
347 }
348
349 panic("unreachable code!")
350}
351
352func addTime(t time.Time, field cronField, value int) time.Time {
353 switch field {

Callers 2

nextFieldMethod · 0.85
elapseUntilFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected