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
5f2eca27
Commit
5f2eca27
authored
Jun 16, 2009
by
Piotr Caban
Committed by
Alexandre Julliard
Jun 16, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added Date_getUTCMilliseconds and Date_getMilliseconds implementation.
parent
3523a1f2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
16 deletions
+58
-16
date.c
dlls/jscript/date.c
+54
-16
api.js
dlls/jscript/tests/api.js
+4
-0
No files found.
dlls/jscript/date.c
View file @
5f2eca27
...
...
@@ -64,12 +64,12 @@ static const WCHAR getMinutesW[] = {'g','e','t','M','i','n','u','t','e','s',0};
static
const
WCHAR
getUTCMinutesW
[]
=
{
'g'
,
'e'
,
't'
,
'U'
,
'T'
,
'C'
,
'M'
,
'i'
,
'n'
,
'u'
,
't'
,
'e'
,
's'
,
0
};
static
const
WCHAR
getSecondsW
[]
=
{
'g'
,
'e'
,
't'
,
'S'
,
'e'
,
'c'
,
'o'
,
'n'
,
'd'
,
's'
,
0
};
static
const
WCHAR
getUTCSecondsW
[]
=
{
'g'
,
'e'
,
't'
,
'U'
,
'T'
,
'C'
,
'S'
,
'e'
,
'c'
,
'o'
,
'n'
,
'd'
,
's'
,
0
};
static
const
WCHAR
getMil
isecondsW
[]
=
{
'g'
,
'e'
,
't'
,
'M'
,
'i
'
,
'l'
,
'i'
,
's'
,
'e'
,
'c'
,
'o'
,
'n'
,
'd'
,
's'
,
0
};
static
const
WCHAR
getUTCMil
isecondsW
[]
=
{
'g'
,
'e'
,
't'
,
'U'
,
'T'
,
'C'
,
'M'
,
'i
'
,
'l'
,
'i'
,
's'
,
'e'
,
'c'
,
'o'
,
'n'
,
'd'
,
's'
,
0
};
static
const
WCHAR
getMil
lisecondsW
[]
=
{
'g'
,
'e'
,
't'
,
'M'
,
'i'
,
'l
'
,
'l'
,
'i'
,
's'
,
'e'
,
'c'
,
'o'
,
'n'
,
'd'
,
's'
,
0
};
static
const
WCHAR
getUTCMil
lisecondsW
[]
=
{
'g'
,
'e'
,
't'
,
'U'
,
'T'
,
'C'
,
'M'
,
'i'
,
'l
'
,
'l'
,
'i'
,
's'
,
'e'
,
'c'
,
'o'
,
'n'
,
'd'
,
's'
,
0
};
static
const
WCHAR
getTimezoneOffsetW
[]
=
{
'g'
,
'e'
,
't'
,
'T'
,
'i'
,
'm'
,
'e'
,
'z'
,
'o'
,
'n'
,
'e'
,
'O'
,
'f'
,
'f'
,
's'
,
'e'
,
't'
,
0
};
static
const
WCHAR
setTimeW
[]
=
{
's'
,
'e'
,
't'
,
'T'
,
'i'
,
'm'
,
'e'
,
0
};
static
const
WCHAR
setMil
isecondsW
[]
=
{
's'
,
'e'
,
't'
,
'M'
,
'i
'
,
'l'
,
'i'
,
's'
,
'e'
,
'c'
,
'o'
,
'n'
,
'd'
,
's'
,
0
};
static
const
WCHAR
setUTCMil
isecondsW
[]
=
{
's'
,
'e'
,
't'
,
'U'
,
'T'
,
'C'
,
'M'
,
'i
'
,
'l'
,
'i'
,
's'
,
'e'
,
'c'
,
'o'
,
'n'
,
'd'
,
's'
,
0
};
static
const
WCHAR
setMil
lisecondsW
[]
=
{
's'
,
'e'
,
't'
,
'M'
,
'i'
,
'l
'
,
'l'
,
'i'
,
's'
,
'e'
,
'c'
,
'o'
,
'n'
,
'd'
,
's'
,
0
};
static
const
WCHAR
setUTCMil
lisecondsW
[]
=
{
's'
,
'e'
,
't'
,
'U'
,
'T'
,
'C'
,
'M'
,
'i'
,
'l
'
,
'l'
,
'i'
,
's'
,
'e'
,
'c'
,
'o'
,
'n'
,
'd'
,
's'
,
0
};
static
const
WCHAR
setSecondsW
[]
=
{
's'
,
'e'
,
't'
,
'S'
,
'e'
,
'c'
,
'o'
,
'n'
,
'd'
,
's'
,
0
};
static
const
WCHAR
setUTCSecondsW
[]
=
{
's'
,
'e'
,
't'
,
'U'
,
'T'
,
'C'
,
'S'
,
'e'
,
'c'
,
'o'
,
'n'
,
'd'
,
's'
,
0
};
static
const
WCHAR
setMinutesW
[]
=
{
's'
,
'e'
,
't'
,
'M'
,
'i'
,
'n'
,
'u'
,
't'
,
'e'
,
's'
,
0
};
...
...
@@ -263,6 +263,20 @@ static inline DOUBLE sec_from_time(DOUBLE time)
return
ret
;
}
/* ECMA-262 3th Edition 15.9.1.10 */
static
inline
DOUBLE
ms_from_time
(
DOUBLE
time
)
{
DOUBLE
ret
;
if
(
isnan
(
time
))
return
ret_nan
();
ret
=
fmod
(
time
,
1000
);
if
(
ret
<
0
)
ret
+=
1000
;
return
ret
;
}
/* ECMA-262 3rd Edition 15.9.1.14 */
static
inline
DOUBLE
time_clip
(
DOUBLE
time
)
{
...
...
@@ -634,18 +648,42 @@ static HRESULT Date_getUTCSeconds(DispatchEx *dispex, LCID lcid, WORD flags, DIS
return
S_OK
;
}
static
HRESULT
Date_getMiliseconds
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
/* ECMA-262 3th Edition 15.9.1.10 */
static
HRESULT
Date_getMilliseconds
(
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
,
ms_from_time
(
time
));
}
return
S_OK
;
}
static
HRESULT
Date_getUTCMiliseconds
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
/* ECMA-262 3th Edition 15.9.1.10 */
static
HRESULT
Date_getUTCMilliseconds
(
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
,
ms_from_time
(
date
->
time
));
}
return
S_OK
;
}
static
HRESULT
Date_getTimezoneOffset
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
...
...
@@ -687,14 +725,14 @@ static HRESULT Date_setTime(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
return
S_OK
;
}
static
HRESULT
Date_setMiliseconds
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
static
HRESULT
Date_setMil
l
iseconds
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
caller
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
Date_setUTCMiliseconds
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
static
HRESULT
Date_setUTCMil
l
iseconds
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
caller
)
{
FIXME
(
"
\n
"
);
...
...
@@ -797,7 +835,7 @@ static const builtin_prop_t Date_props[] = {
{
getDayW
,
Date_getDay
,
PROPF_METHOD
},
{
getFullYearW
,
Date_getFullYear
,
PROPF_METHOD
},
{
getHoursW
,
Date_getHours
,
PROPF_METHOD
},
{
getMil
isecondsW
,
Date_getMiliseconds
,
PROPF_METHOD
},
{
getMil
lisecondsW
,
Date_getMilliseconds
,
PROPF_METHOD
},
{
getMinutesW
,
Date_getMinutes
,
PROPF_METHOD
},
{
getMonthW
,
Date_getMonth
,
PROPF_METHOD
},
{
getSecondsW
,
Date_getSeconds
,
PROPF_METHOD
},
...
...
@@ -807,7 +845,7 @@ static const builtin_prop_t Date_props[] = {
{
getUTCDayW
,
Date_getUTCDay
,
PROPF_METHOD
},
{
getUTCFullYearW
,
Date_getUTCFullYear
,
PROPF_METHOD
},
{
getUTCHoursW
,
Date_getUTCHours
,
PROPF_METHOD
},
{
getUTCMil
isecondsW
,
Date_getUTCMiliseconds
,
PROPF_METHOD
},
{
getUTCMil
lisecondsW
,
Date_getUTCMilliseconds
,
PROPF_METHOD
},
{
getUTCMinutesW
,
Date_getUTCMinutes
,
PROPF_METHOD
},
{
getUTCMonthW
,
Date_getUTCMonth
,
PROPF_METHOD
},
{
getUTCSecondsW
,
Date_getUTCSeconds
,
PROPF_METHOD
},
...
...
@@ -817,7 +855,7 @@ static const builtin_prop_t Date_props[] = {
{
setDateW
,
Date_setDate
,
PROPF_METHOD
},
{
setFullYearW
,
Date_setFullYear
,
PROPF_METHOD
},
{
setHoursW
,
Date_setHours
,
PROPF_METHOD
},
{
setMil
isecondsW
,
Date_setMiliseconds
,
PROPF_METHOD
},
{
setMil
lisecondsW
,
Date_setMilliseconds
,
PROPF_METHOD
},
{
setMinutesW
,
Date_setMinutes
,
PROPF_METHOD
},
{
setMonthW
,
Date_setMonth
,
PROPF_METHOD
},
{
setSecondsW
,
Date_setSeconds
,
PROPF_METHOD
},
...
...
@@ -825,7 +863,7 @@ static const builtin_prop_t Date_props[] = {
{
setUTCDateW
,
Date_setUTCDate
,
PROPF_METHOD
},
{
setUTCFullYearW
,
Date_setUTCFullYear
,
PROPF_METHOD
},
{
setUTCHoursW
,
Date_setUTCHours
,
PROPF_METHOD
},
{
setUTCMil
isecondsW
,
Date_setUTCMiliseconds
,
PROPF_METHOD
},
{
setUTCMil
lisecondsW
,
Date_setUTCMilliseconds
,
PROPF_METHOD
},
{
setUTCMinutesW
,
Date_setUTCMinutes
,
PROPF_METHOD
},
{
setUTCMonthW
,
Date_setUTCMonth
,
PROPF_METHOD
},
{
setUTCSecondsW
,
Date_setUTCSeconds
,
PROPF_METHOD
},
...
...
dlls/jscript/tests/api.js
View file @
5f2eca27
...
...
@@ -953,6 +953,7 @@ ok(date.getUTCDay() === 4, "date.getUTCDay() = " + date.getUTCDay());
ok
(
date
.
getUTCHours
()
===
0
,
"date.getUTCHours() = "
+
date
.
getUTCHours
());
ok
(
date
.
getUTCMinutes
()
===
0
,
"date.getUTCMinutes() = "
+
date
.
getUTCMinutes
());
ok
(
date
.
getUTCSeconds
()
===
0
,
"date.getUTCSeconds() = "
+
date
.
getUTCSeconds
());
ok
(
date
.
getUTCMilliseconds
()
===
0
,
"date.getUTCMilliseconds() = "
+
date
.
getUTCMilliseconds
());
date
.
setTime
(
60
*
24
*
60
*
60
*
1000
);
ok
(
date
.
getUTCFullYear
()
===
1970
,
"date.getUTCFullYear() = "
+
date
.
getUTCFullYear
());
ok
(
date
.
getUTCMonth
()
===
2
,
"date.getUTCMonth() = "
+
date
.
getUTCMonth
());
...
...
@@ -961,6 +962,7 @@ ok(date.getUTCDay() === 1, "date.getUTCDay() = " + date.getUTCDay());
ok
(
date
.
getUTCHours
()
===
0
,
"date.getUTCHours() = "
+
date
.
getUTCHours
());
ok
(
date
.
getUTCMinutes
()
===
0
,
"date.getUTCMinutes() = "
+
date
.
getUTCMinutes
());
ok
(
date
.
getUTCSeconds
()
===
0
,
"date.getUTCSeconds() = "
+
date
.
getUTCSeconds
());
ok
(
date
.
getUTCMilliseconds
()
===
0
,
"date.getUTCMilliseconds() = "
+
date
.
getUTCMilliseconds
());
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
());
...
...
@@ -970,6 +972,7 @@ ok(date.getUTCDay() === 4, "date.getUTCDay() = " + date.getUTCDay());
ok
(
date
.
getUTCHours
()
===
1
,
"date.getUTCHours() = "
+
date
.
getUTCHours
());
ok
(
date
.
getUTCMinutes
()
===
2
,
"date.getUTCMinutes() = "
+
date
.
getUTCMinutes
());
ok
(
date
.
getUTCSeconds
()
===
2
,
"date.getUTCSeconds() = "
+
date
.
getUTCSeconds
());
ok
(
date
.
getUTCMilliseconds
()
===
640
,
"date.getUTCMilliseconds() = "
+
date
.
getUTCMilliseconds
());
date
.
setTime
(
Infinity
);
ok
(
isNaN
(
date
.
getUTCFullYear
()),
"date.getUTCFullYear() is not NaN"
);
ok
(
isNaN
(
date
.
getUTCMonth
()),
"date.getUTCMonth() is not NaN"
);
...
...
@@ -978,6 +981,7 @@ 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
(
isNaN
(
date
.
getUTCSeconds
()),
"date.getUTCSeconds() is not NaN"
);
ok
(
isNaN
(
date
.
getUTCMilliseconds
()),
"date.getUTCMilliseconds() 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