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

Method GetInitialDelay

task.go:42–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

40}
41
42func (task *SchedulerTask) GetInitialDelay() time.Duration {
43 if task.startTime.IsZero() {
44 return 0
45 }
46
47 now := time.Now().In(task.location)
48 diff := time.Date(task.startTime.Year(), task.startTime.Month(), task.startTime.Day(), task.startTime.Hour(), task.startTime.Minute(), task.startTime.Second(), 0, time.Local).Sub(
49 time.Date(now.Year(), now.Month(), now.Day(), now.Hour(), now.Minute(), now.Second(), 0, time.Local))
50
51 if diff < 0 {
52 return 0
53 }
54
55 return diff
56}
57
58type Option func(task *SchedulerTask) error
59

Callers 3

ScheduleMethod · 0.80
ScheduleAtFixedRateMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected