Skip to content

Commit

Permalink
Merge pull request #36 from sideshow/fix-int-range
Browse files Browse the repository at this point in the history
Fix value out of range issue #34
  • Loading branch information
alissonsales authored Aug 17, 2016
2 parents 8104e84 + b5a05f0 commit 0ef66aa
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 0ef66aa

Please sign in to comment.