MCPcopy Create free account
hub / github.com/Kitware/CMake / kwsysProcessGetTimeoutTime

Function kwsysProcessGetTimeoutTime

Source/kwsys/ProcessWin32.c:1957–1984  ·  view source on GitHub ↗

Get the time at which either the process or user timeout will expire. Returns 1 if the user timeout is first, and 0 otherwise. */

Source from the content-addressed store, hash-verified

1955/* Get the time at which either the process or user timeout will
1956 expire. Returns 1 if the user timeout is first, and 0 otherwise. */
1957int kwsysProcessGetTimeoutTime(kwsysProcess* cp, double* userTimeout,
1958 kwsysProcessTime* timeoutTime)
1959{
1960 /* The first time this is called, we need to calculate the time at
1961 which the child will timeout. */
1962 if (cp->Timeout && cp->TimeoutTime.QuadPart < 0) {
1963 kwsysProcessTime length = kwsysProcessTimeFromDouble(cp->Timeout);
1964 cp->TimeoutTime = kwsysProcessTimeAdd(cp->StartTime, length);
1965 }
1966
1967 /* Start with process timeout. */
1968 *timeoutTime = cp->TimeoutTime;
1969
1970 /* Check if the user timeout is earlier. */
1971 if (userTimeout) {
1972 kwsysProcessTime currentTime = kwsysProcessTimeGetCurrent();
1973 kwsysProcessTime userTimeoutLength =
1974 kwsysProcessTimeFromDouble(*userTimeout);
1975 kwsysProcessTime userTimeoutTime =
1976 kwsysProcessTimeAdd(currentTime, userTimeoutLength);
1977 if (timeoutTime->QuadPart < 0 ||
1978 kwsysProcessTimeLess(userTimeoutTime, *timeoutTime)) {
1979 *timeoutTime = userTimeoutTime;
1980 return 1;
1981 }
1982 }
1983 return 0;
1984}
1985
1986/* Get the length of time before the given timeout time arrives.
1987 Returns 1 if the time has already arrived, and 0 otherwise. */

Callers 1

kwsysProcess_WaitForDataFunction · 0.70

Calls 4

kwsysProcessTimeAddFunction · 0.70
kwsysProcessTimeLessFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…