aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEgon Elbre <egonelbre@gmail.com>2024-04-27 18:00:01 +0300
committerGopher Robot <gobot@golang.org>2024-04-27 19:42:36 +0000
commit644a4ff333210f08b23e17139eef4093a5fd882c (patch)
tree968b4d6e7c64eae31886190b9ccad880b4d8dd60
parent774d5b366ce43ed7e304ea3917e353112df9daf7 (diff)
downloadgo-644a4ff333210f08b23e17139eef4093a5fd882c.tar.gz
go-644a4ff333210f08b23e17139eef4093a5fd882c.zip
testing: use time.Since in highPrecisionTime
time.Since has optimizations for measuring monotonic time. For #31160. Change-Id: I0529b9f69b9f008e3414b8e386b6faa64af4a008 Reviewed-on: https://go-review.googlesource.com/c/go/+/582135 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
-rw-r--r--src/testing/testing_other.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/testing/testing_other.go b/src/testing/testing_other.go
index 586f61b0ce..f91e3b4a2c 100644
--- a/src/testing/testing_other.go
+++ b/src/testing/testing_other.go
@@ -27,5 +27,5 @@ func highPrecisionTimeNow() highPrecisionTime {
// highPrecisionTimeSince returns duration since b.
func highPrecisionTimeSince(b highPrecisionTime) time.Duration {
- return time.Now().Sub(b.now)
+ return time.Since(b.now)
}