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
1d35db9f
Commit
1d35db9f
authored
Oct 17, 2017
by
Piotr Caban
Committed by
Alexandre Julliard
Oct 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcp120: Fix _Xtime_diff_to_millis2 overflow behavior.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d9131acb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
+14
-5
misc.c
dlls/msvcp90/misc.c
+14
-5
No files found.
dlls/msvcp90/misc.c
View file @
1d35db9f
...
...
@@ -362,6 +362,7 @@ void __thiscall _Container_base12__Swap_all(
#define TICKS_1601_TO_1970 (SECS_1601_TO_1970 * TICKSPERSEC)
#define NANOSEC_PER_MILLISEC 1000000
#define MILLISEC_PER_SEC 1000
#define NANOSEC_PER_SEC (NANOSEC_PER_MILLISEC * MILLISEC_PER_SEC)
typedef
int
MSVCRT_long
;
...
...
@@ -401,16 +402,24 @@ int __cdecl xtime_get(xtime* t, int unknown)
/* _Xtime_diff_to_millis2 */
MSVCRT_long
__cdecl
_Xtime_diff_to_millis2
(
const
xtime
*
t1
,
const
xtime
*
t2
)
{
__time64_t
diff_sec
;
MSVCRT_long
diff_nsec
,
ret
;
LONGLONG
diff_sec
,
diff_nsec
;
TRACE
(
"(%p, %p)
\n
"
,
t1
,
t2
);
diff_sec
=
t1
->
sec
-
t2
->
sec
;
diff_nsec
=
t1
->
nsec
-
t2
->
nsec
;
ret
=
diff_sec
*
MILLISEC_PER_SEC
+
(
diff_nsec
+
NANOSEC_PER_MILLISEC
-
1
)
/
NANOSEC_PER_MILLISEC
;
return
ret
>
0
?
ret
:
0
;
diff_sec
+=
diff_nsec
/
NANOSEC_PER_SEC
;
diff_nsec
%=
NANOSEC_PER_SEC
;
if
(
diff_nsec
<
0
)
{
diff_sec
-=
1
;
diff_nsec
+=
NANOSEC_PER_SEC
;
}
if
(
diff_sec
<
0
||
(
diff_sec
==
0
&&
diff_nsec
<
0
))
return
0
;
return
diff_sec
*
MILLISEC_PER_SEC
+
(
diff_nsec
+
NANOSEC_PER_MILLISEC
-
1
)
/
NANOSEC_PER_MILLISEC
;
}
/* _Xtime_diff_to_millis */
...
...
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