aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/testing/example.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/testing/example.go')
-rw-r--r--libgo/go/testing/example.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/libgo/go/testing/example.go b/libgo/go/testing/example.go
index 3b026ee..e23f13b 100644
--- a/libgo/go/testing/example.go
+++ b/libgo/go/testing/example.go
@@ -56,9 +56,9 @@ func RunExamples(examples []InternalExample) (ok bool) {
}()
// run example
- ns := -time.Nanoseconds()
+ t0 := time.Now()
eg.F()
- ns += time.Nanoseconds()
+ dt := time.Now().Sub(t0)
// close pipe, restore stdout/stderr, get output
w.Close()
@@ -66,7 +66,7 @@ func RunExamples(examples []InternalExample) (ok bool) {
out := <-outC
// report any errors
- tstr := fmt.Sprintf("(%.2f seconds)", float64(ns)/1e9)
+ tstr := fmt.Sprintf("(%.2f seconds)", dt.Seconds())
if out != eg.Output {
fmt.Printf(
"--- FAIL: %s %s\ngot:\n%s\nwant:\n%s\n",