Bug 585152 - Reland Date.now() fractional changes, along with fixed tests. (r=jwalden,dolske,gavin, rs=jwalden)

For the tests, I put a Math.floor around anything which looked like it did string concatenation. In principal that was r+ by dolske and gavin, and jwalden r+ed the extension to the rest of the tests.

Backout policy: the jsdate.cpp changes can be backed out trivially. The test changes should backout cleanly, but we're not hosed if they don't.
This commit is contained in:
Paul Biggar
2010-08-06 13:35:00 -07:00
parent afc0b96895
commit d42abd8a4f
36 changed files with 61 additions and 49 deletions

View File

@@ -1189,10 +1189,16 @@ NowAsMillis()
return (jsdouble) (PRMJ_Now() / PRMJ_USEC_PER_MSEC);
}
static inline jsdouble
NowAsFractionalsMillis()
{
return (jsdouble) (PRMJ_Now() / double(PRMJ_USEC_PER_MSEC));
}
static JSBool
date_now(JSContext *cx, uintN argc, Value *vp)
{
vp->setDouble(NowAsMillis());
vp->setDouble(NowAsFractionalsMillis());
return JS_TRUE;
}
@@ -1200,7 +1206,7 @@ date_now(JSContext *cx, uintN argc, Value *vp)
static jsdouble FASTCALL
date_now_tn(JSContext*)
{
return NowAsMillis();
return NowAsFractionalsMillis();
}
#endif