Permalink
Browse files

signed dates and the shell

  • Loading branch information...
1 parent 5f5b1e4 commit c38947fe02dcc5986d001d93ed250c02e6854afe @dwight dwight committed Jun 6, 2011
Showing with 6 additions and 3 deletions.
  1. +1 −1 bson/bson-inl.h
  2. +4 −1 jstests/date1.js
  3. +1 −1 scripting/engine_spidermonkey.cpp
View
@@ -677,7 +677,7 @@ namespace mongo {
s << "EOO";
break;
case mongo::Date:
- s << "new Date(" << date() << ')';
+ s << "new Date(" << (long long) date() << ')';
break;
case RegEx: {
s << "/" << regex() << '/';
View
@@ -4,11 +4,14 @@ t = db.date1;
function go( d , msg ){
t.drop();
- t.save( { a : 1 , d : d } );
+ t.save({ a: 1, d: d });
+// printjson(d);
+// printjson(t.findOne().d);
assert.eq( d , t.findOne().d , msg )
}
go( new Date() , "A" )
go( new Date( 1 ) , "B")
go( new Date( 0 ) , "C (old spidermonkey lib fails this test)")
+go(new Date(-10), "neg")
@@ -651,7 +651,7 @@ namespace mongo {
return OBJECT_TO_JSVAL( JS_GetFunctionObject( func ) );
}
case Date:
- return OBJECT_TO_JSVAL( js_NewDateObjectMsec( _context , (jsdouble) e.date().millis ) );
+ return OBJECT_TO_JSVAL( js_NewDateObjectMsec( _context , (jsdouble) ((long long)e.date().millis) ) );
case MinKey:
return OBJECT_TO_JSVAL( JS_NewObject( _context , &minkey_class , 0 , 0 ) );

0 comments on commit c38947f

Please sign in to comment.