diff --git a/timestamp.go b/timestamp.go new file mode 100644 index 0000000..f6b7872 --- /dev/null +++ b/timestamp.go @@ -0,0 +1,20 @@ +package testrail + +import ( + "encoding/json" + "time" +) + +// UNIX timestamp +type timestamp struct { + time.Time +} + +func (ts *timestamp) UnmarshalJSON(data []byte) error { + var seconds int64 + if err := json.Unmarshal(data, &seconds); err != nil { + return err + } + ts.Time = time.Unix(seconds, 0) + return nil +}