9 type Timestamp time.Time
11 func (t *Timestamp) Unix() int64 {
12 return time.Time(*t).Unix()
15 func (t *Timestamp) MarshalJSON() ([]byte, error) {
16 ts := time.Time(*t).Unix()
17 stamp := fmt.Sprint(ts)
18 return []byte(stamp), nil
21 func (t *Timestamp) UnmarshalJSON(b []byte) error {
22 ts, err := strconv.Atoi(string(b))
27 *t = Timestamp(time.Unix(int64(ts), 0))