Skip to content

Commit bcab684

Browse files
hopehookgopherbot
authored andcommittedOct 2, 2022
all: use time.Since instead of time.Now().Sub
Change-Id: Ie6ab0d9b0933f8c0dda84e7f8ad879e01c4eb337 Reviewed-on: https://go-review.googlesource.com/c/net/+/437095 Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Run-TryBot: hopehook <hopehook@golangcn.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
1 parent 107f3e3 commit bcab684

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
 

‎http2/transport.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3049,7 +3049,7 @@ func traceGotConn(req *http.Request, cc *ClientConn, reused bool) {
30493049
cc.mu.Lock()
30503050
ci.WasIdle = len(cc.streams) == 0 && reused
30513051
if ci.WasIdle && !cc.lastActive.IsZero() {
3052-
ci.IdleTime = time.Now().Sub(cc.lastActive)
3052+
ci.IdleTime = time.Since(cc.lastActive)
30533053
}
30543054
cc.mu.Unlock()
30553055

‎trace/trace.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ func New(family, title string) Trace {
395395
}
396396

397397
func (tr *trace) Finish() {
398-
elapsed := time.Now().Sub(tr.Start)
398+
elapsed := time.Since(tr.Start)
399399
tr.mu.Lock()
400400
tr.Elapsed = elapsed
401401
tr.mu.Unlock()

0 commit comments

Comments
 (0)
Please sign in to comment.