You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following implementation loses milliseconds when creating a BSON value.
// MarshalBSONValue is an interface implemented by types that can marshal themselves// into a BSON document represented as bytes. The bytes returned must be a valid// BSON document if the error is nil.// Marshals a DateTime as a bsontype.DateTime, an int64 representing// milliseconds since epoch.func (tDateTime) MarshalBSONValue() (bsontype.Type, []byte, error) {
// UnixNano cannot be used, the result of calling UnixNano on the zero// Time is undefined.i64:=NormalizeTimeForMarshal(time.Time(t)).Unix() *1000buf:=make([]byte, 8)
binary.LittleEndian.PutUint64(buf, uint64(i64))
returnbsontype.DateTime, buf, nil
}
The text was updated successfully, but these errors were encountered:
The following implementation loses milliseconds when creating a BSON value.
The text was updated successfully, but these errors were encountered: