From: Russ Cox Date: Wed, 28 Jun 2017 14:33:15 +0000 (-0400) Subject: time: fix example in monotonic time comment X-Git-Tag: go1.9rc1~146 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=5e585830d3bed2b81b825e1c3e8c244726d091d7;p=gostls13.git time: fix example in monotonic time comment t.Sub(u) would be -20 milliseconds. The right computation is u.Sub(t), but rewrite to be even clearer. Thanks to Karsten Weiss for catching this. Change-Id: I6e274d69b0301840d57c5c65bf4114da0d33bf10 Reviewed-on: https://go-review.googlesource.com/46971 Run-TryBot: Russ Cox TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- diff --git a/src/time/time.go b/src/time/time.go index 3f13e3431c..0a83543e8a 100644 --- a/src/time/time.go +++ b/src/time/time.go @@ -23,10 +23,10 @@ // approximately 20 milliseconds, even if the wall clock is changed during // the operation being timed: // -// t := time.Now() +// start := time.Now() // ... operation that takes 20 milliseconds ... -// u := time.Now() -// elapsed := t.Sub(u) +// t := time.Now() +// elapsed := t.Sub(start) // // Other idioms, such as time.Since(start), time.Until(deadline), and // time.Now().Before(deadline), are similarly robust against wall clock