1
0
mirror of https://github.com/golang/go synced 2024-11-11 20:20:23 -07:00

misc/cgo/test: fix after latest time changes

R=rsc
CC=golang-dev
https://golang.org/cl/5454047
This commit is contained in:
Alex Brainman 2011-12-13 10:46:58 +11:00
parent 3dbecd592b
commit b2cf7b5f6b

View File

@ -36,11 +36,11 @@ func BackgroundSleep(n int) {
}
func testParallelSleep(t *testing.T) {
dt := -time.Nanoseconds()
start := time.Now()
parallelSleep(1)
dt += time.Nanoseconds()
dt := time.Now().Sub(start)
// bug used to run sleeps in serial, producing a 2-second delay.
if dt >= 1.3e9 {
t.Fatalf("parallel 1-second sleeps slept for %f seconds", float64(dt)/1e9)
if dt >= 1300*time.Millisecond {
t.Fatalf("parallel 1-second sleeps slept for %f seconds", dt.Seconds())
}
}