Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
28e033e3
Commit
28e033e3
authored
Jun 09, 2009
by
Piotr Caban
Committed by
Alexandre Julliard
Jun 10, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added Date_getDay and Date_getUTCDay implementation.
parent
190ed2ef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
4 deletions
+41
-4
date.c
dlls/jscript/date.c
+37
-4
api.js
dlls/jscript/tests/api.js
+4
-0
No files found.
dlls/jscript/date.c
View file @
28e033e3
...
...
@@ -206,6 +206,15 @@ static inline DOUBLE date_from_time(DOUBLE time)
return
dwy
-
333
-
ily
;
}
/* ECMA-262 3th Edition 15.9.1.6 */
static
inline
DOUBLE
week_day
(
DOUBLE
time
)
{
if
(
isnan
(
time
))
return
ret_nan
();
return
(
int
)(
day
(
time
)
+
4
)
%
7
;
}
/* ECMA-262 3rd Edition 15.9.1.14 */
static
inline
DOUBLE
time_clip
(
DOUBLE
time
)
{
...
...
@@ -425,18 +434,42 @@ static HRESULT Date_getUTCDate(DispatchEx *dispex, LCID lcid, WORD flags, DISPPA
return
S_OK
;
}
/* ECMA-262 3th Edition 15.9.1.6 */
static
HRESULT
Date_getDay
(
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
,
week_day
(
time
));
}
return
S_OK
;
}
/* ECMA-262 3th Edition 15.9.1.6 */
static
HRESULT
Date_getUTCDay
(
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
,
week_day
(
date
->
time
));
}
return
S_OK
;
}
static
HRESULT
Date_getHours
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
...
...
dlls/jscript/tests/api.js
View file @
28e033e3
...
...
@@ -949,19 +949,23 @@ ok(date.setTime(0) === date.getTime(), "date.setTime(0) !== date.getTime()");
ok
(
date
.
getUTCFullYear
()
===
1970
,
"date.getUTCFullYear() = "
+
date
.
getUTCFullYear
());
ok
(
date
.
getUTCMonth
()
===
0
,
"date.getUTCMonth() = "
+
date
.
getUTCMonth
());
ok
(
date
.
getUTCDate
()
===
1
,
"date.getUTCDate() = "
+
date
.
getUTCDate
());
ok
(
date
.
getUTCDay
()
===
4
,
"date.getUTCDay() = "
+
date
.
getUTCDay
());
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
());
date
.
setTime
(
59
*
24
*
60
*
60
*
1000
+
4
*
365
*
24
*
60
*
60
*
1000
);
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
());
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
(
typeof
(
Math
.
PI
)
===
"number"
,
"typeof(Math.PI) = "
+
typeof
(
Math
.
PI
));
ok
(
Math
.
floor
(
Math
.
PI
*
100
)
===
314
,
"Math.PI = "
+
Math
.
PI
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment