Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

time: TZ parsing on Unix misses some locations #50863

Open
ainar-g opened this issue Jan 27, 2022 · 1 comment
Open

time: TZ parsing on Unix misses some locations #50863

ainar-g opened this issue Jan 27, 2022 · 1 comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@ainar-g
Copy link
Contributor

ainar-g commented Jan 27, 2022

What version of Go are you using (go version)?

$ go version
go version go1.17.6 linux/amd64
go version devel go1.18-b2dc66c64d Thu Jan 27 16:07:55 2022 +0000 linux/amd64

Does this issue reproduce with the latest release?

Yes, see the second Go version.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ainar/.cache/go-build"
GOENV="/home/ainar/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/ainar/go/pkg/mod"
GONOPROXY="REMOVED"
GONOSUMDB="REMOVED"
GOOS="linux"
GOPATH="/home/ainar/go"
GOPRIVATE="REMOVED"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/ainar/go/go1.17"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/ainar/go/go1.17/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17.6"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1714127508=/tmp/go-build -gno-record-gcc-switches"

What did you do?

package main

import "time"

func main() {
	println(time.Now().String())
}
env TZ="EST5EDT,M3.2.0/2,M11.1.0/2" /usr/bin/date
env TZ="EST5EDT,M3.2.0/2,M11.1.0/2" busybox date
env TZ="EST5EDT,M3.2.0/2,M11.1.0/2" go run ./main.go

What did you expect to see?

Thu 27 Jan 12:16:17 EST 2022
Thu Jan 27 12:16:17 EST 2022
2022-01-27 12:16:17.468764876 -0500 EST m=+0.000003001

What did you see instead?

Thu 27 Jan 12:16:17 EST 2022
Thu Jan 27 12:16:17 EST 2022
2022-01-27 17:16:17.468764876 +0000 UTC m=+0.000003001

Additional information

  • /usr/bin/date is from GNU coreutils, version 8.30.

  • The Busybox version is v1.30.1.

  • The format seems to be conformant with the POSIX standard.

  • EST5EDT without the start and end modifiers seems to work.

@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 27, 2022
@mknyszek mknyszek added this to the Backlog milestone Jan 27, 2022
@ianlancetaylor
Copy link
Contributor

I'm not opposed to adding this kind of support, I'll just note that the Go time package never promised to support this format of the TZ environment variable. https://pkg.go.dev/time#Local . It shouldn't be too hard to add if someone wants to send a patch. The TZ value would go into the extend field of the Location.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants