82
// NewTimer creates a Timer that will send the current time on a channel after at least
83
// duration d. It returns the channel and the Timer.
84
>
func (ts *EventTimeSource) NewTimer(d time.Duration) (<-chan time.Time, Timer) {
event_time_source.go
85
>
c := make(chan time.Time, 1)
86
>
// we can't call ts.Now() from the callback so just calculate what it should be
87
>
target := ts.Now().Add(d)
88
>
timer := &fakeTimer{
89
>
timeSource: ts,
90
>
deadline: target,
91
>
callback: func() { c <- target },
92
c: c,
93
}
95
>
return c, timer
96
}
97