File tree Expand file tree Collapse file tree 2 files changed +6
-13
lines changed
Expand file tree Collapse file tree 2 files changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -91,25 +91,24 @@ func (t *Timer) Stop() error {
9191}
9292
9393// WaitTill waits until the internal timer duration is reached.
94- func (t * Timer ) WaitTill (duration time.Duration ) error {
94+ func (t * Timer ) WaitTill (duration time.Duration ) {
9595 if ! t .running {
9696 select {
9797 case t .continueChan <- struct {}{}:
9898 case <- time .After (1 * time .Second ):
99- return nil
99+ return
100100 }
101101 }
102102 sleepTime := duration - t .Elapsed ()
103103 if sleepTime > 0 {
104104 t .SleepConsumer (sleepTime )
105105 }
106- return nil
106+ return
107107}
108108
109109// WaitTillNextFullSecond waits until the internal timer has reached the next full second
110- func (t * Timer ) WaitTillNextFullSecond () error {
110+ func (t * Timer ) WaitTillNextFullSecond () {
111111 elapsed := t .Elapsed ()
112112 nextDuration := elapsed .Truncate (time .Second ) + time .Second
113113 t .WaitTill (nextDuration )
114- return nil
115114}
Original file line number Diff line number Diff line change @@ -56,20 +56,14 @@ func TestTimerWaitTill(t *testing.T) {
5656 t .Error (err )
5757 }
5858 * curTime = curTime .Add (2 * time .Second )
59- err = timer .WaitTill (5 * time .Second )
60- if err != nil {
61- t .Error (err )
62- }
59+ timer .WaitTill (5 * time .Second )
6360 if * sleepDuration != 3 * time .Second {
6461 t .Errorf ("Expected a sleep duration of 3s, but was %v" , * sleepDuration )
6562 }
6663
6764 * sleepDuration = 0
6865 * curTime = curTime .Add (100 * time .Millisecond )
69- err = timer .WaitTillNextFullSecond ()
70- if err != nil {
71- t .Error (err )
72- }
66+ timer .WaitTillNextFullSecond ()
7367 if * sleepDuration != 900 * time .Millisecond {
7468 t .Errorf ("Expected a sleep duration of 900ms, but was %v" , * sleepDuration )
7569 }
You can’t perform that action at this time.
0 commit comments