diff options
author | Kunpei Sakai <namusyaka@gmail.com> | 2018-02-26 20:00:51 +0900 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@golang.org> | 2018-02-26 16:14:51 +0000 |
commit | 7e9a8546e4b6a703b102c074e5620390550d9706 (patch) | |
tree | 6dc2933d44efbaf04f35f6f5a54264a7d8f107b8 /src/time | |
parent | dd3b4714be643321babc859b807399aa288a4475 (diff) | |
download | go-git-7e9a8546e4b6a703b102c074e5620390550d9706.tar.gz |
time: avoid unnecessary type conversions
Change-Id: Ic318c25b21298ec123eb27c814c79f637887713c
Reviewed-on: https://go-review.googlesource.com/97135
Run-TryBot: Kunpei Sakai <namusyaka@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/time')
-rw-r--r-- | src/time/time.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/time/time.go b/src/time/time.go index 93909682f5..5e357e1aec 100644 --- a/src/time/time.go +++ b/src/time/time.go @@ -158,7 +158,7 @@ func (t *Time) sec() int64 { if t.wall&hasMonotonic != 0 { return wallToInternal + int64(t.wall<<1>>(nsecShift+1)) } - return int64(t.ext) + return t.ext } // unixSec returns the time's seconds since Jan 1 1970 (Unix time). @@ -205,7 +205,7 @@ func (t *Time) stripMono() { // setMono is a no-op. func (t *Time) setMono(m int64) { if t.wall&hasMonotonic == 0 { - sec := int64(t.ext) + sec := t.ext if sec < minWall || maxWall < sec { return } @@ -855,7 +855,7 @@ func (t Time) Add(d Duration) Time { t.addSec(dsec) if t.wall&hasMonotonic != 0 { te := t.ext + int64(d) - if d < 0 && te > int64(t.ext) || d > 0 && te < int64(t.ext) { + if d < 0 && te > t.ext || d > 0 && te < t.ext { // Monotonic clock reading now out of range; degrade to wall-only. t.stripMono() } else { @@ -871,8 +871,8 @@ func (t Time) Add(d Duration) Time { // To compute t-d for a duration d, use t.Add(-d). func (t Time) Sub(u Time) Duration { if t.wall&u.wall&hasMonotonic != 0 { - te := int64(t.ext) - ue := int64(u.ext) + te := t.ext + ue := u.ext d := Duration(te - ue) if d < 0 && te > ue { return maxDuration // t - u is positive out of range |