minor: c ext return dates as UTC, update credits, tweak last commit
This commit is contained in:
parent
91b1b0ad8f
commit
6cd976398e
|
@ -290,6 +290,9 @@ John Nunemaker, http://railstips.org
|
||||||
* Collection#create_index takes symbols as well as strings
|
* Collection#create_index takes symbols as well as strings
|
||||||
* Fix for Collection#save
|
* Fix for Collection#save
|
||||||
|
|
||||||
|
David James, djames@sunlightfoundation.com
|
||||||
|
* Fix dates to return as UTC
|
||||||
|
|
||||||
= License
|
= License
|
||||||
|
|
||||||
Copyright 2008-2009 10gen Inc.
|
Copyright 2008-2009 10gen Inc.
|
||||||
|
|
|
@ -541,6 +541,7 @@ static VALUE get_value(const char* buffer, int* position, int type) {
|
||||||
VALUE microseconds = INT2NUM((millis % 1000) * 1000);
|
VALUE microseconds = INT2NUM((millis % 1000) * 1000);
|
||||||
|
|
||||||
value = rb_funcall(Time, rb_intern("at"), 2, seconds, microseconds);
|
value = rb_funcall(Time, rb_intern("at"), 2, seconds, microseconds);
|
||||||
|
value = rb_funcall(value, rb_intern("utc"), 0)
|
||||||
*position += 8;
|
*position += 8;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,7 +245,7 @@ class BSON
|
||||||
|
|
||||||
def deserialize_date_data(buf)
|
def deserialize_date_data(buf)
|
||||||
millisecs = buf.get_long()
|
millisecs = buf.get_long()
|
||||||
Time.at(millisecs.to_f / 1000.0).utc
|
Time.at(millisecs.to_f / 1000.0).utc # at() takes fractional seconds
|
||||||
end
|
end
|
||||||
|
|
||||||
def deserialize_boolean_data(buf)
|
def deserialize_boolean_data(buf)
|
||||||
|
|
|
@ -58,7 +58,7 @@ class XMLToRuby
|
||||||
when 'array'
|
when 'array'
|
||||||
array_to_ruby(e.elements)
|
array_to_ruby(e.elements)
|
||||||
when 'date'
|
when 'date'
|
||||||
Time.at(e.text.to_f / 1000.0).utc
|
Time.at(e.text.to_f / 1000.0)
|
||||||
when 'regex'
|
when 'regex'
|
||||||
regex_to_ruby(e.elements)
|
regex_to_ruby(e.elements)
|
||||||
when 'null'
|
when 'null'
|
||||||
|
|
|
@ -121,7 +121,7 @@ class BSONTest < Test::Unit::TestCase
|
||||||
doc = {'date' => Time.now}
|
doc = {'date' => Time.now}
|
||||||
@b.serialize(doc)
|
@b.serialize(doc)
|
||||||
doc2 = @b.deserialize
|
doc2 = @b.deserialize
|
||||||
assert_equal "UTC", doc2['date'].zone
|
assert doc2['date'].utc?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_dbref
|
def test_dbref
|
||||||
|
|
Loading…
Reference in New Issue