Get the length of time before the given timeout time arrives. Returns 1 if the time has already arrived, and 0 otherwise. */
| 1986 | /* Get the length of time before the given timeout time arrives. |
| 1987 | Returns 1 if the time has already arrived, and 0 otherwise. */ |
| 1988 | int kwsysProcessGetTimeoutLeft(kwsysProcessTime* timeoutTime, |
| 1989 | double* userTimeout, |
| 1990 | kwsysProcessTime* timeoutLength) |
| 1991 | { |
| 1992 | if (timeoutTime->QuadPart < 0) { |
| 1993 | /* No timeout time has been requested. */ |
| 1994 | return 0; |
| 1995 | } else { |
| 1996 | /* Calculate the remaining time. */ |
| 1997 | kwsysProcessTime currentTime = kwsysProcessTimeGetCurrent(); |
| 1998 | *timeoutLength = kwsysProcessTimeSubtract(*timeoutTime, currentTime); |
| 1999 | |
| 2000 | if (timeoutLength->QuadPart < 0 && userTimeout && *userTimeout <= 0) { |
| 2001 | /* Caller has explicitly requested a zero timeout. */ |
| 2002 | timeoutLength->QuadPart = 0; |
| 2003 | } |
| 2004 | |
| 2005 | if (timeoutLength->QuadPart < 0) { |
| 2006 | /* Timeout has already expired. */ |
| 2007 | return 1; |
| 2008 | } else { |
| 2009 | /* There is some time left. */ |
| 2010 | return 0; |
| 2011 | } |
| 2012 | } |
| 2013 | } |
| 2014 | |
| 2015 | kwsysProcessTime kwsysProcessTimeGetCurrent() |
| 2016 | { |
no test coverage detected
searching dependent graphs…