Closed
Description
What version of Go are you using (go version
)?
$ go version go version go1.17.1 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/iain/.cache/go-build" GOENV="/home/iain/.config/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/iain/src/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/iain/src/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/lib/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.17.1" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/dev/null" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build284408099=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Adding 1000 (1e3) to a time.Time
with Nanoseconds set to 999999999
doesn't increment the second anymore. This worked in go 1.16.8
but is now not incrementing the second in go 1.17.1
https://play.golang.org/p/DxYFLO40v6R
package main
import (
"fmt"
"time"
)
func main() {
t := time.Unix(1<<63-62135596801, 999999999)
fmt.Println(t)
fmt.Println(t.Add(1e3))
}
go 1.16 output:
292277024627-12-06 15:30:07.999999999 +0000 UTC
292277024627-12-06 15:30:08.000000999 +0000 UTC
go 1.17 output:
292277024627-12-06 15:30:07.999999999 +0000 UTC
292277024627-12-06 15:30:07.000000999 +0000 UTC
What did you expect to see?
Same behaviour where the second is incremented correctly
What did you see instead?
The nanoseconds loop back around in the same way but the second is no longer incremented