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

archive/zip: document that zip times are stored/loaded using UTC #7592

Closed
gopherbot opened this issue Mar 20, 2014 · 8 comments
Closed

archive/zip: document that zip times are stored/loaded using UTC #7592

gopherbot opened this issue Mar 20, 2014 · 8 comments
Milestone

Comments

@gopherbot
Copy link

by 518lee:

What does 'go version' print?
go version go1.2.1 linux/amd64
go version go1.2.1 windows/386

What steps reproduce the problem?
1. My computer time local is UTC+8
2. I write some codes to create a zip file:
     // Create a new zip archive.
    zw := zip.NewWriter(fw)
    defer zw.Close()

    //create zip dir item
    ffh := &zip.FileHeader{
        Name:   zipInnerFolder,
        Method: zip.Deflate,
    }
    ffh.SetModTime(time.Now())
    ffh.SetMode(os.ModeDir)

    //open zip dir item writor
    zw.CreateHeader(ffh)
3. When I run above code, the ModTime of the zip item is wrong(always UTC time)

What happened?
The ModTime of the zip item is wrong(always UTC time)


What should have happened instead?
The ModTime of the zip item should be just the right time based on the computer timezone

Please provide any additional information below.

Line 171: http://golang.org/src/pkg/archive/zip/struct.go

just remove this line or modify it to :
t = t.In(time.Local)

Others info:
https://groups.google.com/forum/#!topic/golang-checkins/hfyN7EHBH3A
@ianlancetaylor
Copy link
Contributor

Comment 1:

Labels changed: added repo-main, release-go1.3.

@rsc
Copy link
Contributor

rsc commented Apr 3, 2014

Comment 2:

A priori I think it is a toss-up what the right thing to do is. Given that, we should
opt for what we're already doing, to avoid churn and breaking existing code.

Status changed to Accepted.

@gopherbot
Copy link
Author

Comment 3 by 518lee:

Or add a new method to give the people a choice.
but if we do nothing with this issue, how about the quality?

@gopherbot
Copy link
Author

Comment 4 by tyler@stretchr.com:

I've created a CL for this issue here: https://golang.org/cl/90810043

@gopherbot
Copy link
Author

Comment 5 by tylerbunnell:

I've created a CL for this issue here: https://golang.org/cl/90810043

@minux
Copy link
Member

minux commented Apr 28, 2014

Comment 6:

@tylerbunnell, please run "hg mail 90810043" otherwise we won't see the CL.

Status changed to Started.

@gopherbot
Copy link
Author

Comment 7:

CL https://golang.org/cl/90810043 mentions this issue.

@adg
Copy link
Contributor

adg commented May 5, 2014

Comment 8:

This issue was closed by revision be781a7.

Status changed to Fixed.

@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@rsc rsc removed the release-go1.3 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants