Skip to content

Commit fd9103b

Browse files
committed
Merge branch 'mysql-5.6' into mysql-5.7
Conflicts: mysys/my_wincond.c
2 parents 10ce6b7 + 7201061 commit fd9103b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

include/thr_cond.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef THR_COND_INCLUDED
22
#define THR_COND_INCLUDED
33

4-
/* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
4+
/* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
55
66
This program is free software; you can redistribute it and/or modify
77
it under the terms of the GNU General Public License as published by
@@ -86,8 +86,12 @@ static DWORD get_milliseconds(const struct timespec *abstime)
8686
Convert timespec to millis and subtract current time.
8787
my_getsystime() returns time in 100 ns units.
8888
*/
89-
return (DWORD)(abstime->tv_sec * 1000 + abstime->tv_nsec / 1000000 -
90-
my_getsystime() / 10000);
89+
ulonglong future= abstime->tv_sec * 1000 + abstime->tv_nsec / 1000000;
90+
ulonglong now= my_getsystime() / 10000;
91+
/* Don't allow the timeout to be negative. */
92+
if (future < now)
93+
return 0;
94+
return (DWORD)(future - now);
9195
#endif
9296
}
9397
#endif /* _WIN32 */

0 commit comments

Comments
 (0)