This is similar to CL 518336.
For #61765.
Change-Id: I7c1d92a3b3e2b6c1c0058a2094997d93082ad139
Reviewed-on: https://go-review.googlesource.com/c/go/+/521237
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
// Until returns the duration until t.
// It is shorthand for t.Sub(time.Now()).
func Until(t Time) Duration {
- var now Time
if t.wall&hasMonotonic != 0 {
// Common case optimization: if t has monotonic time, then Sub will use only it.
- now = Time{hasMonotonic, runtimeNano() - startNano, nil}
- } else {
- now = Now()
+ return subMono(t.ext, runtimeNano()-startNano)
}
- return t.Sub(now)
+ return t.Sub(Now())
}
// AddDate returns the time corresponding to adding the