Skip to content

time: parsing zoneinfo files with no transition times causes lookup() to provide UTC #4064

@fluffle

Description

@fluffle
--- 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeSuggestedIssues that may be good for new contributors looking for work to do.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions