76
// Update the timer gate, return true if update is a success.
77
// Success means timer is idle or timer is set with a sooner time to fire
78
>
func (lg *LocalGateImpl) Update(nextTime time.Time) bool {
local_gate.go
79
>
// NOTE: negative duration will make the timer fire immediately
80
>
now := lg.timeSource.Now()
81
>
82
>
if lg.timer.Stop() && lg.nextWakeupTime.Before(nextTime) {
83
// this means the timer, before stopped, is active && next wake-up time do not have to be updated
84
lg.timer.Reset(lg.nextWakeupTime.Sub(now))