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
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