Merge topic 'positive-test-times'

e319e32 CTest: make sure never to report negative test times (#14132)
This commit is contained in:
Brad King 2013-05-16 14:38:20 -04:00 committed by CMake Topic Stage
commit 07d8492178
1 changed files with 8 additions and 0 deletions

View File

@ -175,6 +175,14 @@ int cmProcess::GetNextOutputLine(std::string& line, double timeout)
// Record exit information.
this->ExitValue = cmsysProcess_GetExitValue(this->Process);
this->TotalTime = cmSystemTools::GetTime() - this->StartTime;
// Because of a processor clock scew the runtime may become slightly
// negative. If someone changed the system clock while the process was
// running this may be even more. Make sure not to report a negative
// duration here.
if (this->TotalTime <= 0.0)
{
this->TotalTime = 0.0;
}
// std::cerr << "Time to run: " << this->TotalTime << "\n";
return cmsysProcess_Pipe_None;
}