Commit 122198a2 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Added Date.getTime() implementation.

parent 9932f29e
...@@ -168,11 +168,22 @@ static HRESULT Date_toLocaleTimeString(DispatchEx *dispex, LCID lcid, WORD flags ...@@ -168,11 +168,22 @@ static HRESULT Date_toLocaleTimeString(DispatchEx *dispex, LCID lcid, WORD flags
return E_NOTIMPL; return E_NOTIMPL;
} }
/* ECMA-262 3rd Edition 15.9.5.9 */
static HRESULT Date_getTime(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp, static HRESULT Date_getTime(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller) VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{ {
FIXME("\n"); TRACE("\n");
return E_NOTIMPL;
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(retv) {
DateInstance *date = (DateInstance*)dispex;
num_set_val(retv, date->time);
}
return S_OK;
} }
static HRESULT Date_getFullYear(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp, static HRESULT Date_getFullYear(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
......
...@@ -449,4 +449,10 @@ ok(testFuncToString.toString() === "function testFuncToString(x,y) {\n return ...@@ -449,4 +449,10 @@ ok(testFuncToString.toString() === "function testFuncToString(x,y) {\n return
ok("" + testFuncToString === "function testFuncToString(x,y) {\n return x+y;\n}", ok("" + testFuncToString === "function testFuncToString(x,y) {\n return x+y;\n}",
"'' + testFuncToString = " + testFuncToString); "'' + testFuncToString = " + testFuncToString);
var date = new Date();
date = new Date(100);
ok(date.getTime() === 100, "date.getTime() = " + date.getTime());
ok(Date.prototype.getTime() === 0, "date.prototype.getTime() = " + Date.prototype.getTime());
reportSuccess(); reportSuccess();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment