Get the time at which either the process or user timeout will expire. Returns 1 if the user timeout is first, and 0 otherwise. */
| 1983 | /* Get the time at which either the process or user timeout will |
| 1984 | expire. Returns 1 if the user timeout is first, and 0 otherwise. */ |
| 1985 | static int kwsysProcessGetTimeoutTime(kwsysProcess* cp, |
| 1986 | double const* userTimeout, |
| 1987 | kwsysProcessTime* timeoutTime) |
| 1988 | { |
| 1989 | /* The first time this is called, we need to calculate the time at |
| 1990 | which the child will timeout. */ |
| 1991 | if (cp->Timeout > 0 && cp->TimeoutTime.tv_sec < 0) { |
| 1992 | kwsysProcessTime length = kwsysProcessTimeFromDouble(cp->Timeout); |
| 1993 | cp->TimeoutTime = kwsysProcessTimeAdd(cp->StartTime, length); |
| 1994 | } |
| 1995 | |
| 1996 | /* Start with process timeout. */ |
| 1997 | *timeoutTime = cp->TimeoutTime; |
| 1998 | |
| 1999 | /* Check if the user timeout is earlier. */ |
| 2000 | if (userTimeout) { |
| 2001 | kwsysProcessTime currentTime = kwsysProcessTimeGetCurrent(); |
| 2002 | kwsysProcessTime userTimeoutLength = |
| 2003 | kwsysProcessTimeFromDouble(*userTimeout); |
| 2004 | kwsysProcessTime userTimeoutTime = |
| 2005 | kwsysProcessTimeAdd(currentTime, userTimeoutLength); |
| 2006 | if (timeoutTime->tv_sec < 0 || |
| 2007 | kwsysProcessTimeLess(userTimeoutTime, *timeoutTime)) { |
| 2008 | *timeoutTime = userTimeoutTime; |
| 2009 | return 1; |
| 2010 | } |
| 2011 | } |
| 2012 | return 0; |
| 2013 | } |
| 2014 | |
| 2015 | #if defined(__clang__) && defined(__has_warning) |
| 2016 | # if __has_warning("-Wshorten-64-to-32") |
no test coverage detected
searching dependent graphs…