diff options
author | Alex Guerrieri <alex@tyba.com> | 2015-11-23 18:04:12 +0100 |
---|---|---|
committer | Alex Guerrieri <alex@tyba.com> | 2015-11-23 18:04:12 +0100 |
commit | 4f537be5c121129961ddaf74af004a9c2c00d973 (patch) | |
tree | 33b5e734d8c38cb93429d3328a07e0280b5b4f8b /objects.go | |
parent | caab43e7f4ee10a15b2af826485b688473b34356 (diff) | |
download | go-git-4f537be5c121129961ddaf74af004a9c2c00d973.tar.gz |
Timezone fixes
Diffstat (limited to 'objects.go')
-rw-r--r-- | objects.go | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -76,7 +76,15 @@ func (s *Signature) Decode(b []byte) { if c == ' ' || end { t, err := strconv.ParseInt(string(b[from:i]), 10, 64) if err == nil { - s.When = time.Unix(t, 0) + loc := time.UTC + ts := time.Unix(t, 0) + if len(b[i:]) >= 6 { + tl, err := time.Parse(" -0700", string(b[i:i+6])) + if err == nil { + loc = tl.Location() + } + } + s.When = ts.In(loc) } end = true } |