diff options
-rw-r--r-- | testdata/timers.go | 50 | ||||
-rw-r--r-- | testdata/timers.txt | 22 |
2 files changed, 36 insertions, 36 deletions
diff --git a/testdata/timers.go b/testdata/timers.go index 13fb207be..ed3d4ca5b 100644 --- a/testdata/timers.go +++ b/testdata/timers.go @@ -4,51 +4,51 @@ import "time" func main() { // Test ticker. - ticker := time.NewTicker(time.Millisecond * 250) + ticker := time.NewTicker(time.Millisecond * 500) println("waiting on ticker") go func() { - time.Sleep(time.Millisecond * 125) - println(" - after 125ms") - time.Sleep(time.Millisecond * 250) - println(" - after 375ms") - time.Sleep(time.Millisecond * 250) - println(" - after 625ms") + time.Sleep(time.Millisecond * 150) + println(" - after 150ms") + time.Sleep(time.Millisecond * 200) + println(" - after 200ms") + time.Sleep(time.Millisecond * 300) + println(" - after 300ms") }() <-ticker.C - println("waited on ticker at 250ms") - <-ticker.C println("waited on ticker at 500ms") + <-ticker.C + println("waited on ticker at 1000ms") ticker.Stop() - time.Sleep(time.Millisecond * 500) + time.Sleep(time.Millisecond * 750) select { case <-ticker.C: println("fail: ticker should have stopped!") default: - println("ticker was stopped (didn't send anything after 500ms)") + println("ticker was stopped (didn't send anything after 750ms)") } - timer := time.NewTimer(time.Millisecond * 250) + timer := time.NewTimer(time.Millisecond * 500) println("waiting on timer") go func() { - time.Sleep(time.Millisecond * 125) - println(" - after 125ms") - time.Sleep(time.Millisecond * 250) - println(" - after 250ms") + time.Sleep(time.Millisecond * 200) + println(" - after 200ms") + time.Sleep(time.Millisecond * 400) + println(" - after 400ms") }() <-timer.C - println("waited on timer at 250ms") - time.Sleep(time.Millisecond * 250) + println("waited on timer at 500ms") + time.Sleep(time.Millisecond * 500) - reset := timer.Reset(time.Millisecond * 250) + reset := timer.Reset(time.Millisecond * 500) println("timer reset:", reset) println("waiting on timer") go func() { - time.Sleep(time.Millisecond * 125) - println(" - after 125ms") - time.Sleep(time.Millisecond * 250) - println(" - after 250ms") + time.Sleep(time.Millisecond * 200) + println(" - after 200ms") + time.Sleep(time.Millisecond * 400) + println(" - after 400ms") }() <-timer.C - println("waited on timer at 250ms") - time.Sleep(time.Millisecond * 250) + println("waited on timer at 500ms") + time.Sleep(time.Millisecond * 500) } diff --git a/testdata/timers.txt b/testdata/timers.txt index 544e15b06..355216d98 100644 --- a/testdata/timers.txt +++ b/testdata/timers.txt @@ -1,16 +1,16 @@ waiting on ticker - - after 125ms -waited on ticker at 250ms - - after 375ms + - after 150ms + - after 200ms waited on ticker at 500ms - - after 625ms -ticker was stopped (didn't send anything after 500ms) + - after 300ms +waited on ticker at 1000ms +ticker was stopped (didn't send anything after 750ms) waiting on timer - - after 125ms -waited on timer at 250ms - - after 250ms + - after 200ms +waited on timer at 500ms + - after 400ms timer reset: false waiting on timer - - after 125ms -waited on timer at 250ms - - after 250ms + - after 200ms +waited on timer at 500ms + - after 400ms |