diff options
author | Brad King <brad.king@kitware.com> | 2017-12-08 08:07:26 -0500 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-12-08 08:31:00 -0500 |
commit | de0035fdcccb4c8acc92bf1db0a76b3c1f18003f (patch) | |
tree | 58f87d5434d985246b07a94189af806768ae75de /Source/CTest/cmCTestBuildAndTestHandler.cxx | |
parent | 687a26b7023748cc98317eae53ee2ac3cc520bda (diff) | |
download | cmake-de0035fdcccb4c8acc92bf1db0a76b3c1f18003f.tar.gz |
cmCTestBuildAndTestHandler: Convert timeout to std::chrono::duration
Diffstat (limited to 'Source/CTest/cmCTestBuildAndTestHandler.cxx')
-rw-r--r-- | Source/CTest/cmCTestBuildAndTestHandler.cxx | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 672087d93f..85d98d0882 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -11,6 +11,7 @@ #include "cmsys/Process.h" #include <chrono> +#include <ratio> #include <stdlib.h> cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler() @@ -18,7 +19,7 @@ cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler() this->BuildTwoConfig = false; this->BuildNoClean = false; this->BuildNoCMake = false; - this->Timeout = 0; + this->Timeout = std::chrono::duration<double>::zero(); } void cmCTestBuildAndTestHandler::Initialize() @@ -224,10 +225,9 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) } for (std::string const& tar : this->BuildTargets) { std::chrono::duration<double> remainingTime = std::chrono::seconds(0); - if (this->Timeout > 0) { - remainingTime = std::chrono::duration<double>(this->Timeout) - - std::chrono::duration_cast<std::chrono::seconds>( - std::chrono::steady_clock::now() - clock_start); + if (this->Timeout > std::chrono::duration<double>::zero()) { + remainingTime = + this->Timeout - (std::chrono::steady_clock::now() - clock_start); if (remainingTime <= std::chrono::seconds(0)) { if (outstring) { *outstring = "--build-and-test timeout exceeded. "; @@ -324,10 +324,9 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) // how much time is remaining std::chrono::duration<double> remainingTime = std::chrono::seconds(0); - if (this->Timeout > 0) { - remainingTime = std::chrono::duration<double>(this->Timeout) - - std::chrono::duration_cast<std::chrono::seconds>( - std::chrono::steady_clock::now() - clock_start); + if (this->Timeout > std::chrono::duration<double>::zero()) { + remainingTime = + this->Timeout - (std::chrono::steady_clock::now() - clock_start); if (remainingTime <= std::chrono::seconds(0)) { if (outstring) { *outstring = "--build-and-test timeout exceeded. "; @@ -396,7 +395,7 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments( } if (currentArg.find("--test-timeout", 0) == 0 && idx < allArgs.size() - 1) { idx++; - this->Timeout = atof(allArgs[idx].c_str()); + this->Timeout = std::chrono::duration<double>(atof(allArgs[idx].c_str())); } if (currentArg == "--build-generator" && idx < allArgs.size() - 1) { idx++; |