jscript: Added Date_getUTCMinutes and Date_getMinutes implementation.
This commit is contained in:
parent
73a0f2c900
commit
a005865f45
|
@ -235,6 +235,20 @@ static inline DOUBLE hour_from_time(DOUBLE time)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* ECMA-262 3th Edition 15.9.1.10 */
|
||||
static inline DOUBLE min_from_time(DOUBLE time)
|
||||
{
|
||||
DOUBLE ret;
|
||||
|
||||
if(isnan(time))
|
||||
return ret_nan();
|
||||
|
||||
ret = fmod(floor(time/MS_PER_MINUTE), 60);
|
||||
if(ret<0) ret += 60;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 15.9.1.14 */
|
||||
static inline DOUBLE time_clip(DOUBLE time)
|
||||
{
|
||||
|
@ -530,18 +544,42 @@ static HRESULT Date_getUTCHours(DispatchEx *dispex, LCID lcid, WORD flags, DISPP
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
/* ECMA-262 3th Edition 15.9.1.10 */
|
||||
static HRESULT Date_getMinutes(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("\n");
|
||||
|
||||
if(!is_class(dispex, JSCLASS_DATE)) {
|
||||
FIXME("throw TypeError\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if(retv) {
|
||||
DateInstance *date = (DateInstance*)dispex;
|
||||
DOUBLE time = date->time - date->bias*MS_PER_MINUTE;
|
||||
|
||||
num_set_val(retv, min_from_time(time));
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/* ECMA-262 3th Edition 15.9.1.10 */
|
||||
static HRESULT Date_getUTCMinutes(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
|
||||
{
|
||||
FIXME("\n");
|
||||
return E_NOTIMPL;
|
||||
TRACE("\n");
|
||||
|
||||
if(!is_class(dispex, JSCLASS_DATE)) {
|
||||
FIXME("throw TypeError\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if(retv) {
|
||||
DateInstance *date = (DateInstance*)dispex;
|
||||
num_set_val(retv, min_from_time(date->time));
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT Date_getSeconds(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS *dp,
|
||||
|
|
|
@ -951,25 +951,29 @@ ok(date.getUTCMonth() === 0, "date.getUTCMonth() = " + date.getUTCMonth());
|
|||
ok(date.getUTCDate() === 1, "date.getUTCDate() = " + date.getUTCDate());
|
||||
ok(date.getUTCDay() === 4, "date.getUTCDay() = " + date.getUTCDay());
|
||||
ok(date.getUTCHours() === 0, "date.getUTCHours() = " + date.getUTCHours());
|
||||
ok(date.getUTCMinutes() === 0, "date.getUTCMinutes() = " + date.getUTCMinutes());
|
||||
date.setTime(60*24*60*60*1000);
|
||||
ok(date.getUTCFullYear() === 1970, "date.getUTCFullYear() = " + date.getUTCFullYear());
|
||||
ok(date.getUTCMonth() === 2, "date.getUTCMonth() = " + date.getUTCMonth());
|
||||
ok(date.getUTCDate() === 2, "date.getUTCDate() = " + date.getUTCDate());
|
||||
ok(date.getUTCDay() === 1, "date.getUTCDay() = " + date.getUTCDay());
|
||||
ok(date.getUTCHours() === 0, "date.getUTCHours() = " + date.getUTCHours());
|
||||
date.setTime(59*24*60*60*1000 + 4*365*24*60*60*1000 + 1000*60*60);
|
||||
ok(date.getUTCMinutes() === 0, "date.getUTCMinutes() = " + date.getUTCMinutes());
|
||||
date.setTime(59*24*60*60*1000 + 4*365*24*60*60*1000 + 60*60*1000 + 2*60*1000 + 2*1000 + 640);
|
||||
ok(date.getUTCFullYear() === 1974, "date.getUTCFullYear() = " + date.getUTCFullYear());
|
||||
ok(date.getUTCMonth() === 1, "date.getUTCMonth() = " + date.getUTCMonth());
|
||||
ok(date.getUTCMonth(123) === 1, "date.getUTCMonth() = " + date.getUTCMonth());
|
||||
ok(date.getUTCDate() === 28, "date.getUTCDate() = " + date.getUTCDate());
|
||||
ok(date.getUTCDay() === 4, "date.getUTCDay() = " + date.getUTCDay());
|
||||
ok(date.getUTCHours() === 1, "date.getUTCHours() = " + date.getUTCHours());
|
||||
ok(date.getUTCMinutes() === 2, "date.getUTCMinutes() = " + date.getUTCMinutes());
|
||||
date.setTime(Infinity);
|
||||
ok(isNaN(date.getUTCFullYear()), "date.getUTCFullYear() is not NaN");
|
||||
ok(isNaN(date.getUTCMonth()), "date.getUTCMonth() is not NaN");
|
||||
ok(isNaN(date.getUTCDate()), "date.getUTCDate() is not NaN");
|
||||
ok(isNaN(date.getUTCDay()), "date.getUTCDay() is not NaN");
|
||||
ok(isNaN(date.getUTCHours()), "date.getUTCHours() is not NaN");
|
||||
ok(isNaN(date.getUTCMinutes()), "date.getUTCMinutes() is not NaN");
|
||||
|
||||
ok(typeof(Math.PI) === "number", "typeof(Math.PI) = " + typeof(Math.PI));
|
||||
ok(Math.floor(Math.PI*100) === 314, "Math.PI = " + Math.PI);
|
||||
|
|
Loading…
Reference in New Issue