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: parsing zoneinfo files with no transition times causes lookup() to provide UTC #4064

Closed
fluffle opened this issue Sep 11, 2012 · 8 comments

Comments

Projects
None yet
3 participants
@fluffle
Copy link

commented Sep 11, 2012

--- Overview:

time.LoadLocation() on POSIX systems eventually uses loadZoneData() in zoneinfo_read.go
to parse a zoneinfo file for timezone data. When the zoneinfo file doesn't contain any
timezone transition data -- see, for example, "Etc/GMT+4" -- this causes calls
to Location.lookup() to return UTC times (line 104, zoneinfo.go).

Since FixedZone() creates a Location with a single fake transition (line 86,
zoneinfo.go), it seems like the "best" solution here is to do the same for
zoneinfo files that are also fixed. I've attached a patch to this bug report, I'd have
submitted it for review but mercurial on Goobuntu is Too Damn Old to run the codereview
plugin :-/


--- What steps will reproduce the problem?

An example that *should* work is here:
http://play.golang.org/p/0OqoIdw3gk

Unfortunately play.golang.org doesn't have timezone data available. It works when 'go
run'


--- What is the expected output?

Time is: 2004-03-02 13:14:15 +0000 UTC
Time in GMT+4 is: 2004-03-02 09:14:15 -0400 GMT+4


--- What do you see instead?

Time is: 2004-03-02 13:14:15 +0000 UTC
Time in GMT+4 is: 2004-03-02 13:14:15 +0000 UTC


--- Which compiler are you using (5g, 6g, 8g, gccgo)?

6g


--- Which operating system are you using?

Various debian-based linuxes (found the bug at home, reported it from work)


--- Which version are you using?  (run 'go version')

go 1.0.2

Attachments:

  1. patch (443 bytes)
@fluffle

This comment has been minimized.

Copy link
Author

commented Sep 11, 2012

Comment 1:

Managed to create a rietveld CL manually via the UI with a bit of patch munging:
https://golang.org/cl/6503100/
@fluffle

This comment has been minimized.

Copy link
Author

commented Sep 11, 2012

Comment 2:

Not enough, it'd seem. Bleh. Sorry!
@rsc

This comment has been minimized.

Copy link
Contributor

commented Sep 11, 2012

Comment 3:

Don't worry about it. We can take it from here. Thanks.
@rsc

This comment has been minimized.

Copy link
Contributor

commented Sep 12, 2012

Comment 4:

Labels changed: added priority-later, removed priority-triage.

Status changed to Accepted.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Sep 12, 2012

Comment 5:

Labels changed: added go1.1.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Dec 10, 2012

Comment 6:

Labels changed: added size-m.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Dec 10, 2012

Comment 7:

Labels changed: added suggested.

@rsc

This comment has been minimized.

Copy link
Contributor

commented Feb 4, 2013

Comment 8:

This issue was closed by revision 6a003d7.

Status changed to Fixed.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015

@rsc rsc removed the go1.1 label Apr 14, 2015

@golang golang locked and limited conversation to collaborators Jun 24, 2016

This issue was closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.