NewDisableableTicker essentially wraps NewTicker but allows the ticker to be disabled by passing zero duration as the interval. Returns a function for stopping the ticker, and the ticker channel.
(interval time.Duration)
| 112 | // NewDisableableTicker essentially wraps NewTicker but allows the ticker to be disabled by passing |
| 113 | // zero duration as the interval. Returns a function for stopping the ticker, and the ticker channel. |
| 114 | func NewDisableableTicker(interval time.Duration) (func(), <-chan time.Time) { |
| 115 | if interval == 0 { |
| 116 | return func() {}, nil |
| 117 | } |
| 118 | |
| 119 | tick := time.NewTicker(interval) |
| 120 | return func() { tick.Stop() }, tick.C |
| 121 | } |
| 122 | |
| 123 | // FindMinMaxTime returns the time in milliseconds of the earliest and latest point in time the statement will try to process. |
| 124 | // This takes into account offsets, @ modifiers, and range selectors. |