diff --git a/interoperability/ocss/time.go b/interoperability/ocss/time.go index fef4548..5f303fd 100644 --- a/interoperability/ocss/time.go +++ b/interoperability/ocss/time.go @@ -12,14 +12,14 @@ import ( type OCSSTime time.Time -func (t OCSSTime) MarshalJSON() ([]byte, error) { - //do your serializing here - stamp := fmt.Sprintf("%v", time.Time(t).Unix()) +func (t *OCSSTime) MarshalJSON() ([]byte, error) { + // do your serializing here + stamp := fmt.Sprintf("%v", time.Time(*t).Unix()) return []byte(stamp), nil } -func (v OCSSTime) MarshalBSONValue() (bsontype.Type, []byte, error) { - return bson.MarshalValue(time.Time(v)) +func (v *OCSSTime) MarshalBSONValue() (bsontype.Type, []byte, error) { + return bson.MarshalValue(time.Time(*v)) } func (t *OCSSTime) UnmarshalJSON(b []byte) error { @@ -39,7 +39,6 @@ func (t *OCSSTime) UnmarshalJSON(b []byte) error { } func (t *OCSSTime) UnmarshalBSONValue(bt bsontype.Type, b []byte) error { - if bt == bsontype.Null || len(b) == 0 { return nil }