Skip to content

Commit

Permalink
Fix value out of range issue #34
Browse files Browse the repository at this point in the history
  • Loading branch information
sideshow committed Aug 2, 2016
1 parent eacc6af commit b5a05f0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions response.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,12 @@ type Time struct {
time.Time
}

// UnmarshalJSON converts an epoch date into a Time struct.
func (t *Time) UnmarshalJSON(b []byte) error {
ts, err := strconv.Atoi(string(b))
ts, err := strconv.ParseInt(string(b), 10, 64)
if err != nil {
return err
}
t.Time = time.Unix(int64(ts/1000), 0)
t.Time = time.Unix(ts/1000, 0)
return nil
}

0 comments on commit b5a05f0

Please sign in to comment.