forked from cerc-io/plugeth
all: use AbsTime.Add instead of conversion (#25417)
This commit is contained in:
@@ -58,7 +58,7 @@ func (s *Simulated) Run(d time.Duration) {
|
||||
s.mu.Lock()
|
||||
s.init()
|
||||
|
||||
end := s.now + AbsTime(d)
|
||||
end := s.now.Add(d)
|
||||
var do []func()
|
||||
for len(s.scheduled) > 0 && s.scheduled[0].at <= end {
|
||||
ev := heap.Pop(&s.scheduled).(*simTimer)
|
||||
@@ -134,7 +134,7 @@ func (s *Simulated) AfterFunc(d time.Duration, fn func()) Timer {
|
||||
func (s *Simulated) schedule(d time.Duration, fn func()) *simTimer {
|
||||
s.init()
|
||||
|
||||
at := s.now + AbsTime(d)
|
||||
at := s.now.Add(d)
|
||||
ev := &simTimer{do: fn, at: at, s: s}
|
||||
heap.Push(&s.scheduled, ev)
|
||||
s.cond.Broadcast()
|
||||
|
||||
Reference in New Issue
Block a user