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
305aee06
Commit
305aee06
authored
Jun 22, 2009
by
Piotr Caban
Committed by
Alexandre Julliard
Jun 23, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added Date_getTimezoneOffset and fixed Date_get... functions.
parent
b529cdb6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
10 deletions
+43
-10
date.c
dlls/jscript/date.c
+27
-10
api.js
dlls/jscript/tests/api.js
+16
-0
No files found.
dlls/jscript/date.c
View file @
305aee06
...
...
@@ -315,6 +315,12 @@ static inline DOUBLE daylight_saving_ta(DOUBLE time, DateInstance *date)
}
/* ECMA-262 3rd Edition 15.9.1.9 */
static
inline
DOUBLE
local_time
(
DOUBLE
time
,
DateInstance
*
date
)
{
return
time
-
(
daylight_saving_ta
(
time
,
date
)
+
date
->
bias
)
*
MS_PER_MINUTE
;
}
/* ECMA-262 3rd Edition 15.9.1.9 */
static
inline
DOUBLE
utc
(
DOUBLE
time
,
DateInstance
*
date
)
{
time
+=
date
->
bias
*
MS_PER_MINUTE
;
...
...
@@ -525,7 +531,7 @@ static HRESULT Date_getFullYear(DispatchEx *dispex, LCID lcid, WORD flags, DISPP
if
(
retv
)
{
DateInstance
*
date
=
(
DateInstance
*
)
dispex
;
DOUBLE
time
=
date
->
time
-
date
->
bias
*
MS_PER_MINUTE
;
DOUBLE
time
=
local_time
(
date
->
time
,
date
)
;
num_set_val
(
retv
,
year_from_time
(
time
));
}
...
...
@@ -563,7 +569,7 @@ static HRESULT Date_getMonth(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARA
if
(
retv
)
{
DateInstance
*
date
=
(
DateInstance
*
)
dispex
;
DOUBLE
time
=
date
->
time
-
date
->
bias
*
MS_PER_MINUTE
;
DOUBLE
time
=
local_time
(
date
->
time
,
date
)
;
num_set_val
(
retv
,
month_from_time
(
time
));
}
...
...
@@ -601,7 +607,7 @@ static HRESULT Date_getDate(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
if
(
retv
)
{
DateInstance
*
date
=
(
DateInstance
*
)
dispex
;
DOUBLE
time
=
date
->
time
-
date
->
bias
*
MS_PER_MINUTE
;
DOUBLE
time
=
local_time
(
date
->
time
,
date
)
;
num_set_val
(
retv
,
date_from_time
(
time
));
}
...
...
@@ -639,7 +645,7 @@ static HRESULT Date_getDay(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS
if
(
retv
)
{
DateInstance
*
date
=
(
DateInstance
*
)
dispex
;
DOUBLE
time
=
date
->
time
-
date
->
bias
*
MS_PER_MINUTE
;
DOUBLE
time
=
local_time
(
date
->
time
,
date
)
;
num_set_val
(
retv
,
week_day
(
time
));
}
...
...
@@ -677,7 +683,7 @@ static HRESULT Date_getHours(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARA
if
(
retv
)
{
DateInstance
*
date
=
(
DateInstance
*
)
dispex
;
DOUBLE
time
=
date
->
time
-
date
->
bias
*
MS_PER_MINUTE
;
DOUBLE
time
=
local_time
(
date
->
time
,
date
)
;
num_set_val
(
retv
,
hour_from_time
(
time
));
}
...
...
@@ -715,7 +721,7 @@ static HRESULT Date_getMinutes(DispatchEx *dispex, LCID lcid, WORD flags, DISPPA
if
(
retv
)
{
DateInstance
*
date
=
(
DateInstance
*
)
dispex
;
DOUBLE
time
=
date
->
time
-
date
->
bias
*
MS_PER_MINUTE
;
DOUBLE
time
=
local_time
(
date
->
time
,
date
)
;
num_set_val
(
retv
,
min_from_time
(
time
));
}
...
...
@@ -753,7 +759,7 @@ static HRESULT Date_getSeconds(DispatchEx *dispex, LCID lcid, WORD flags, DISPPA
if
(
retv
)
{
DateInstance
*
date
=
(
DateInstance
*
)
dispex
;
DOUBLE
time
=
date
->
time
-
date
->
bias
*
MS_PER_MINUTE
;
DOUBLE
time
=
local_time
(
date
->
time
,
date
)
;
num_set_val
(
retv
,
sec_from_time
(
time
));
}
...
...
@@ -791,7 +797,7 @@ static HRESULT Date_getMilliseconds(DispatchEx *dispex, LCID lcid, WORD flags, D
if
(
retv
)
{
DateInstance
*
date
=
(
DateInstance
*
)
dispex
;
DOUBLE
time
=
date
->
time
-
date
->
bias
*
MS_PER_MINUTE
;
DOUBLE
time
=
local_time
(
date
->
time
,
date
)
;
num_set_val
(
retv
,
ms_from_time
(
time
));
}
...
...
@@ -819,8 +825,19 @@ static HRESULT Date_getUTCMilliseconds(DispatchEx *dispex, LCID lcid, WORD flags
static
HRESULT
Date_getTimezoneOffset
(
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
,
floor
(
(
date
->
time
-
local_time
(
date
->
time
,
date
))
/
MS_PER_MINUTE
));
}
return
S_OK
;
}
static
HRESULT
Date_setTime
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
...
...
dlls/jscript/tests/api.js
View file @
305aee06
...
...
@@ -940,6 +940,22 @@ date = new Date(8.64e15+1);
ok
(
isNaN
(
0
+
date
.
getTime
()),
"date.getTime() is not NaN"
);
date
=
new
Date
(
Infinity
);
ok
(
isNaN
(
0
+
date
.
getTime
()),
"date.getTime() is not NaN"
);
date
=
new
Date
(
1984
,
11
,
29
,
13
,
51
,
24
,
120
);
ok
(
date
.
getFullYear
()
===
1984
,
"date.getFullYear() = "
+
date
.
getFullYear
());
ok
(
date
.
getMonth
()
===
11
,
"date.getMonth() = "
+
date
.
getMonth
());
ok
(
date
.
getDate
()
===
29
,
"date.getDate() = "
+
date
.
getDate
());
ok
(
date
.
getHours
()
===
13
,
"date.getHours() = "
+
date
.
getHours
());
ok
(
date
.
getMinutes
()
===
51
,
"date.getMinutes() = "
+
date
.
getMinutes
());
ok
(
date
.
getSeconds
()
===
24
,
"date.getSeconds() = "
+
date
.
getSeconds
());
ok
(
date
.
getMilliseconds
()
===
120
,
"date.getMilliseconds() = "
+
date
.
getMilliseconds
());
date
=
new
Date
(
731
,
-
32
,
40
,
-
1
,
70
,
65
,
-
13
);
ok
(
date
.
getFullYear
()
===
728
,
"date.getFullYear() = "
+
date
.
getFullYear
());
ok
(
date
.
getMonth
()
===
5
,
"date.getMonth() = "
+
date
.
getMonth
());
ok
(
date
.
getDate
()
===
9
,
"date.getDate() = "
+
date
.
getDate
());
ok
(
date
.
getHours
()
===
0
,
"date.getHours() = "
+
date
.
getHours
());
ok
(
date
.
getMinutes
()
===
11
,
"date.getMinutes() = "
+
date
.
getMinutes
());
ok
(
date
.
getSeconds
()
===
4
,
"date.getSeconds() = "
+
date
.
getSeconds
());
ok
(
date
.
getMilliseconds
()
===
987
,
"date.getMilliseconds() = "
+
date
.
getMilliseconds
());
ok
(
date
.
setTime
(
123
)
===
123
,
"date.setTime(123) !== 123"
);
ok
(
date
.
setTime
(
"123"
,
NaN
)
===
123
,
"date.setTime(
\"
123
\"
) !== 123"
);
...
...
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