Skip to content

time: On Windows, zone name returned by Zone() method sometimes cannot be used in time.LoadLocation #5909

@gopherbot

Description

@gopherbot

by diogomfranco:

Found when running http://play.golang.org/p/La5gHqlGU- on a Windows system
set to the (UTC -03:00) Brasilia timezone (with or without DST).
Output:

> ESAST -10800
> unknown time zone ESAST

This also affects time.Parse: time.Parse("MST",
time.Now().Format("MST")),
or time.UnixDate or any template including a timezone results in a parsing
error. With the "MST" template, the error is `cannot parse "ESAST"
as "MST"`,
but with time.UnixDate the error is the odd `cannot parse "ESAST 2013" as
"MST"`.

Apparently Windows exports the timezone name as "E. South America Standard
Time", while the name given in the zoneinfo database included with Go, it's
named BRT. Go uses the OS to get the timezone name (and abbreviation?), but
it doesn't use the OS to do the reverse mapping, and we get that.

On other OSes, Go (IIRC) uses the zoneinfo database, so this bug probably
doesn't exist there.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions