I'm trying to unmarshal unix time from a json stream.  Why is my custom 
type UnixTime printing a completely different format of the time? 
 Shouldn't it be just a normal time.Time format?

type UnixTime time.Time

func (t *UnixTime) UnmarshalJSON(b []byte) error {
ts, _ := strconv.Atoi(string(b))

fmt.Println("time:", time.Unix(int64(ts), 0))
*t = UnixTime(time.Unix(int64(ts), 0))
fmt.Println("Unixtime:", *t)

return nil
}

//output

time: 2016-11-19 05:58:58 +0000 UTC
Unixtime: {63615131938 0 0x196f20}




Play link (full code): https://play.golang.org/p/FfhBI5lq2K

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to