UnmarshalJSON turns JSON into a Timestamp
(data []byte)
| 72 | |
| 73 | // UnmarshalJSON turns JSON into a Timestamp |
| 74 | func (t *Timestamp) UnmarshalJSON(data []byte) error { |
| 75 | timestamp, err := strconv.ParseInt(string(data), 10, 64) |
| 76 | if err != nil { |
| 77 | return err |
| 78 | } |
| 79 | *t = Timestamp(time.Unix(timestamp/1e3, (timestamp%1e3)*1e6).UTC()) |
| 80 | return nil |
| 81 | } |
| 82 | |
| 83 | // HasVersion returns true if it looks like the passed filename has a timestamp on it. |
| 84 | // |