Fixed DATE ser/deser bug.
This commit is contained in:
parent
15055794c7
commit
17bbc83f5d
|
@ -157,7 +157,8 @@ class BSON
|
||||||
end
|
end
|
||||||
|
|
||||||
def deserialize_date_data(buf)
|
def deserialize_date_data(buf)
|
||||||
Time.at(buf.get_long)
|
millisecs = buf.get_long()
|
||||||
|
Time.at(millisecs.to_f / 1000.0) # at() takes fractional seconds
|
||||||
end
|
end
|
||||||
|
|
||||||
def deserialize_boolean_data(buf)
|
def deserialize_boolean_data(buf)
|
||||||
|
@ -223,7 +224,8 @@ class BSON
|
||||||
def serialize_date_element(buf, key, val)
|
def serialize_date_element(buf, key, val)
|
||||||
buf.put(DATE)
|
buf.put(DATE)
|
||||||
self.class.serialize_cstr(buf, key)
|
self.class.serialize_cstr(buf, key)
|
||||||
buf.put_long(val.to_i)
|
millisecs = (val.to_f * 1000).to_i
|
||||||
|
buf.put_long(millisecs)
|
||||||
end
|
end
|
||||||
|
|
||||||
def serialize_number_element(buf, key, val, type)
|
def serialize_number_element(buf, key, val, type)
|
||||||
|
|
Loading…
Reference in New Issue