File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 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 */
You can’t perform that action at this time.
0 commit comments