]> Cypherpunks repositories - gostls13.git/commitdiff
testing/synctest: correct duration in doc example
authorSean Liao <sean@liao.dev>
Sat, 24 May 2025 11:10:12 +0000 (12:10 +0100)
committerSean Liao <sean@liao.dev>
Sat, 24 May 2025 15:42:04 +0000 (08:42 -0700)
Fixes #73839

Change-Id: I961641c6d8244cdeb101a3c9ae91931828a893ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/676035
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
src/testing/synctest/synctest.go

index 73fb0a325124f61aca4aa37bda72e816bf28c9d8..aeac8c4b437b0fefdf045b8dd6ea64fd0728ea4e 100644 (file)
 //             synctest.Test(t, func(t *testing.T) {
 //                     start := time.Now() // always midnight UTC 2001-01-01
 //                     go func() {
-//                             time.Sleep(1 * time.Nanosecond)
-//                             t.Log(time.Since(start)) // always logs "1ns"
+//                             time.Sleep(1 * time.Second)
+//                             t.Log(time.Since(start)) // always logs "1s"
 //                     }()
-//                     time.Sleep(2 * time.Nanosecond) // the goroutine above will run before this Sleep returns
-//                     t.Log(time.Since(start))        // always logs "2ns"
+//                     time.Sleep(2 * time.Second) // the goroutine above will run before this Sleep returns
+//                     t.Log(time.Since(start))    // always logs "2s"
 //             })
 //     }
 //