-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
ExpertNeededFrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Description
What version of Go are you using (go version)?
$ go version go version go1.13.8 windows/amd64
Does this issue reproduce with the latest release?
always
What operating system and processor architecture are you using (go env)?
go env Output
$ go env set GO111MODULE=on set GOARCH=amd64 set GOBIN= set GOCACHE=C:\Users\小年糕\AppData\Local\go-build set GOENV=C:\Users\小年糕\AppData\Roaming\go\env set GOEXE=.exe set GOFLAGS= -mod= set GOHOSTARCH=amd64 set GOHOSTOS=windows set GONOPROXY=git.windimg.com set GONOSUMDB=git.windimg.com set GOOS=windows set GOPATH=C:\gopath set GOPRIVATE=git.windimg.com set GOPROXY=direct set GOROOT=C:\goroot set GOSUMDB=sum.golang.org set GOTMPDIR= set GOTOOLDIR=C:\goroot\pkg\tool\windows_amd64 set GCCGO=gccgo set AR=ar set CC=gcc set CXX=g++ set CGO_ENABLED=1 set GOMOD=C:\gopath\src\git.windimg.com\giantart\art-usercenter\go.mod set CGO_CFLAGS=-g -O2 set CGO_CPPFLAGS= set CGO_CXXFLAGS=-g -O2 set CGO_FFLAGS=-g -O2 set CGO_LDFLAGS=-g -O2 set PKG_CONFIG=pkg-config set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Use rs\小年糕\AppData\Local\Temp\go-build796280254=/tmp/go-build -gno-record-gcc-switches
What did you do?
func Test_time_convert(t *testing.T) {
tz, err := time.LoadLocation("Asia/Shanghai")
assert.Nil(t, err)
t1 := time.Date(1890, 01, 01, 0, 0, 0, 0, tz)
fmt.Println(t1.Unix())
t2 := time.Unix(t1.Unix(), 0)
fmt.Println(t2)
}
What did you expect to see?
t2 print output is 1890-01-01 00:00:00 +0800 CST
What did you see instead?
1889-12-31 23:54:17 +0800 CST
btw:
I got this:
https://history.stackexchange.com/questions/8287/why-did-the-clocks-go-back-in-shanghai-on-december-31-1927
and it's means there was a timezone change since 1927.
BUT i try the code from 1890 to 1905,then found out in 1905 case ,t1 equals to t2.
any help will be appreciated
Metadata
Metadata
Assignees
Labels
ExpertNeededFrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.