Skip to content

time: TZ env variable doesn't support uncommon formats #50863

@ainar-g

Description

@ainar-g

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions