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: RFC3339Nano returns different results of different OS. #28598

Closed
3timeslazy opened this issue Nov 5, 2018 · 1 comment
Closed

time: RFC3339Nano returns different results of different OS. #28598

3timeslazy opened this issue Nov 5, 2018 · 1 comment

Comments

@3timeslazy
Copy link

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

$ go version
go version go1.11.2 darwin/amd64

Does this issue reproduce with the latest release?

yes

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

Mac OS:
- GOARCH="amd64"
- GOOS="darwin"

Linux:
- GOARCH="amd64"
- GOOS="linux"

What did you do?

package main

import (
	"fmt"
	"time"
)

func main() {
	t := time.Date(2018, time.November, 5, 0, 54, 15, 5125, time.Local)
	fmt.Println(t.Format(time.RFC3339Nano))
}

What did you expect to see?

I expect to see the same result on all OS. Ex. 2018-11-05T00:54:15.000005125+03:00

What did you see instead?

On Mac OS: 2018-11-05T00:54:15.000005125+03:00
On Linux: 2018-11-05T00:54:15.000005125Z

@ianlancetaylor
Copy link
Contributor

The Go standard library just takes the system's setting for time.Local. Your MacOS system is in +03:00, your GNU/Linux system is in UTC (or more likely simply unconfigured). This isn't something we can fix in Go.

@golang golang locked and limited conversation to collaborators Nov 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants