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

bytesconv.go gmtLocation Issues #29

Closed
ilanyu opened this issue Jan 2, 2016 · 3 comments
Closed

bytesconv.go gmtLocation Issues #29

ilanyu opened this issue Jan 2, 2016 · 3 comments

Comments

@ilanyu
Copy link

ilanyu commented Jan 2, 2016

var gmtLocation = func() *time.Location {
    x, err := time.LoadLocation("GMT")
    if err != nil {
        panic(fmt.Sprintf("cannot load GMT location: %s", err))
    }
    return x
}()

I think should use UTC timezone

x, err := time.LoadLocation("GMT")
// LoadLocation returns the Location with the given name.
//
// If the name is "" or "UTC", LoadLocation returns UTC.
// If the name is "Local", LoadLocation returns Local.
//
// Otherwise, the name is taken to be a location name corresponding to a file
// in the IANA Time Zone database, such as "America/New_York".
//
// The time zone database needed by LoadLocation may not be
// present on all systems, especially non-Unix systems.
// LoadLocation looks in the directory or uncompressed zip file
// named by the ZONEINFO environment variable, if any, then looks in
// known installation locations on Unix systems,
// and finally looks in $GOROOT/lib/time/zoneinfo.zip.
func LoadLocation(name string) (*Location, error) {
    if name == "" || name == "UTC" {
        return UTC, nil
    }
    if name == "Local" {
        return Local, nil
    }
    if zoneinfo != "" {
        if z, err := loadZoneFile(zoneinfo, name); err == nil {
            z.name = name
            return z, nil
        }
    }
    return loadLocation(name)
}

If user not install go sdk, the $GOROOT/lib/time/zoneinfo.zip will not found

@valyala
Copy link
Owner

valyala commented Jan 2, 2016

Thanks for the report. At the first sight it looks like UTC may be used here instead of GMT unless http standard disallows this. I'll look closer into this after the weekend.

valyala added a commit that referenced this issue Jan 4, 2016
… may fail on systems without certain config files
@valyala
Copy link
Owner

valyala commented Jan 4, 2016

@ilanyu , the issue has been fixed.

@valyala valyala closed this as completed Jan 4, 2016
@ilanyu
Copy link
Author

ilanyu commented Jan 6, 2016

Thanks!

zwirec pushed a commit to zwirec/fasthttp that referenced this issue Jul 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants