mirror of
https://github.com/golang/go
synced 2024-11-21 22:34:48 -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:
parent
3dbecd592b
commit
b2cf7b5f6b
@ -36,11 +36,11 @@ func BackgroundSleep(n int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func testParallelSleep(t *testing.T) {
|
func testParallelSleep(t *testing.T) {
|
||||||
dt := -time.Nanoseconds()
|
start := time.Now()
|
||||||
parallelSleep(1)
|
parallelSleep(1)
|
||||||
dt += time.Nanoseconds()
|
dt := time.Now().Sub(start)
|
||||||
// bug used to run sleeps in serial, producing a 2-second delay.
|
// bug used to run sleeps in serial, producing a 2-second delay.
|
||||||
if dt >= 1.3e9 {
|
if dt >= 1300*time.Millisecond {
|
||||||
t.Fatalf("parallel 1-second sleeps slept for %f seconds", float64(dt)/1e9)
|
t.Fatalf("parallel 1-second sleeps slept for %f seconds", dt.Seconds())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user