-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Description
What version of Go are you using (go version)?
go version go1.13 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
GO111MODULE="" GOARCH="amd64" GOBIN="/home/icholy/go/bin" GOCACHE="/home/icholy/.cache/go-build" GOENV="/home/icholy/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/icholy/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="" 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-build269389064=/tmp/go-build -gno-record-gcc-switches"
What did you do?
package main
import (
"fmt"
"time"
)
func main() {
t, err := time.Parse(time.RFC1123, "Wed, 25 Dec 2019 20:09:20 EST")
if err != nil {
panic(err)
}
fmt.Println(t.Zone())
}https://play.golang.org/p/k6d-epEgF-1
What did you expect to see?
A way to detect between a zero offset and an unknown offset. I want to detect/block unknown timezone names before they enter the database with the wrong offset.
What did you see instead?
Lines 1174 to 1179 in a4c579e
| // Otherwise, create fake zone with unknown offset. | |
| if len(zoneName) > 3 && zoneName[:3] == "GMT" { | |
| offset, _ = atoi(zoneName[3:]) // Guaranteed OK by parseGMT. | |
| offset *= 3600 | |
| } | |
| t.setLoc(FixedZone(zoneName, offset)) |