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: Parse fails with timezone names like AUSEDT #4838

Closed
alexbrainman opened this issue Feb 17, 2013 · 8 comments

Comments

Projects
None yet
5 participants
@alexbrainman
Copy link
Member

commented Feb 17, 2013

What steps will reproduce the problem?
1. run this

package main

import (
    "fmt"
    "log"
    "time"
)

func main() {
    t1 := time.Now()
    t2, err := time.Parse(time.RFC1123, t1.Format(time.RFC1123))
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("t1=%v\nt2=%v\n", t1, t2)
}

What is the expected output?

Something like:

t1=2013-02-18 10:21:51.382931992 +1100 EST
t2=2013-02-18 10:21:51 +1100 EST

What do you see instead?

2013/02/18 10:22:10 parsing time "Mon, 18 Feb 2013 10:22:10 AUSEDT" as
"Mon, 02 Jan 2006 15:04:05 MST": cannot parse "AUSEDT" as
"MST"
@davecheney

This comment has been minimized.

Copy link
Contributor

commented Feb 18, 2013

Comment 1:

WFM, 
lucky(~/src) % date
Mon Feb 18 11:07:09 EST 2013
lucky(~/src) % go run time.go 
t1=2013-02-18 11:07:13.685621108 +1100 EST
t2=2013-02-18 11:07:13 +1100 EST
Why does Windows think AUSEST is a valid timezone, IANNA would disagree.
@alexbrainman

This comment has been minimized.

Copy link
Member Author

commented Feb 18, 2013

Comment 2:

Read the code. Windows does not know or care what IANNA. My windows timezone is "AUS
Eastern Daylight Time". Russ made what we need out of what we are given. Doesn't always
work, therefore the bug.
Alex
@alexbrainman

This comment has been minimized.

Copy link
Member Author

commented Feb 18, 2013

Comment 3:

Russ,
I have created little program http://play.golang.org/p/n6b-4C4Bqf to list all timezones
on my computer. It applies abbrev function to both standard and day-light-saving
timezone descriptions to produce appropriate abbrevs (The output attached).
How should I fix time.Parse to handle strings returned by abrev? Perhaps abrev needs to
change.
Thank you.
Alex

Attachments:

  1. a.txt (6098 bytes)
@remyoudompheng

This comment has been minimized.

Copy link
Contributor

commented Feb 18, 2013

Comment 4:

I suggest merging this issue with issue #3790.
@alexbrainman

This comment has been minimized.

Copy link
Member Author

commented Feb 19, 2013

Comment 5:

Looks similar to me. Thank you, Remy. I will leave it for Russ to decide.
Alex
@rsc

This comment has been minimized.

Copy link
Contributor

commented Feb 19, 2013

Comment 6:

I agree that this is related to issue #3790. However, in issue #3790 the problem is to
recognize actual abbreviations that people use. In this issue, the abbreviations are
fakes that we have created because Windows won't give us the real ones. Perhaps we
should fix this issue by doing a better job at abbreviating. If the 200 or so lines in
Alex's attachment are really all the possible time zones, then we should be able to
write a better abbreviator with the necessary cases to handle them all correctly.
The worst abbreviation we have now is "UTC+10" => "UTC". That should probably stay
"UTC+10", but we should also probably make package time recognize that as an
abbreviation. I'll add a note about that case to issue #3790.
@rsc

This comment has been minimized.

Copy link
Contributor

commented Mar 12, 2013

Comment 7:

[The time for maybe has passed.]

Labels changed: removed go1.1maybe.

@alexbrainman

This comment has been minimized.

Copy link
Member Author

commented Jun 6, 2013

Comment 8:

This issue was closed by revision 07ea243.

Status changed to Fixed.

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.