all: use time.Until where applicable

Updates #14595

Change-Id: Idf60b3004c7a0ebb59dd48389ab62c854069e09f
Reviewed-on: https://go-review.googlesource.com/28073
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Brad Fitzpatrick 2016-08-30 01:05:18 +00:00
parent f513433c3e
commit 0d6f47c2a7

2
tls.go
View File

@ -102,7 +102,7 @@ func DialWithDialer(dialer *net.Dialer, network, addr string, config *Config) (*
timeout := dialer.Timeout timeout := dialer.Timeout
if !dialer.Deadline.IsZero() { if !dialer.Deadline.IsZero() {
deadlineTimeout := dialer.Deadline.Sub(time.Now()) deadlineTimeout := time.Until(dialer.Deadline)
if timeout == 0 || deadlineTimeout < timeout { if timeout == 0 || deadlineTimeout < timeout {
timeout = deadlineTimeout timeout = deadlineTimeout
} }