diff options
Diffstat (limited to 'Source/CTest/cmCTestUpdateHandler.cxx')
-rw-r--r-- | Source/CTest/cmCTestUpdateHandler.cxx | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index e08a9b7..809abd1 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmCTestUpdateHandler.h" +#include "cmAlgorithms.h" #include "cmCLocaleEnvironmentScope.h" #include "cmCTest.h" #include "cmCTestBZR.h" @@ -16,7 +17,8 @@ #include "cmVersion.h" #include "cmXMLWriter.h" -#include "cm_auto_ptr.hxx" +#include <chrono> +#include <memory> // IWYU pragma: keep #include <sstream> static const char* cmCTestUpdateHandlerUpdateStrings[] = { @@ -39,7 +41,7 @@ cmCTestUpdateHandler::cmCTestUpdateHandler() void cmCTestUpdateHandler::Initialize() { this->Superclass::Initialize(); - this->UpdateCommand = ""; + this->UpdateCommand.clear(); this->UpdateType = e_CVS; } @@ -134,28 +136,28 @@ int cmCTestUpdateHandler::ProcessHandler() , this->Quiet); // Create an object to interact with the VCS tool. - CM_AUTO_PTR<cmCTestVC> vc; + std::unique_ptr<cmCTestVC> vc; switch (this->UpdateType) { case e_CVS: - vc.reset(new cmCTestCVS(this->CTest, ofs)); + vc = cm::make_unique<cmCTestCVS>(this->CTest, ofs); break; case e_SVN: - vc.reset(new cmCTestSVN(this->CTest, ofs)); + vc = cm::make_unique<cmCTestSVN>(this->CTest, ofs); break; case e_BZR: - vc.reset(new cmCTestBZR(this->CTest, ofs)); + vc = cm::make_unique<cmCTestBZR>(this->CTest, ofs); break; case e_GIT: - vc.reset(new cmCTestGIT(this->CTest, ofs)); + vc = cm::make_unique<cmCTestGIT>(this->CTest, ofs); break; case e_HG: - vc.reset(new cmCTestHG(this->CTest, ofs)); + vc = cm::make_unique<cmCTestHG>(this->CTest, ofs); break; case e_P4: - vc.reset(new cmCTestP4(this->CTest, ofs)); + vc = cm::make_unique<cmCTestP4>(this->CTest, ofs); break; default: - vc.reset(new cmCTestVC(this->CTest, ofs)); + vc = cm::make_unique<cmCTestVC>(this->CTest, ofs); break; } vc->SetCommandLineTool(this->UpdateCommand); @@ -174,9 +176,8 @@ int cmCTestUpdateHandler::ProcessHandler() return -1; } std::string start_time = this->CTest->CurrentTime(); - unsigned int start_time_time = - static_cast<unsigned int>(cmSystemTools::GetTime()); - double elapsed_time_start = cmSystemTools::GetTime(); + auto start_time_time = std::chrono::system_clock::now(); + auto elapsed_time_start = std::chrono::steady_clock::now(); bool updated = vc->Update(); std::string buildname = @@ -223,11 +224,11 @@ int cmCTestUpdateHandler::ProcessHandler() cmCTestOptionalLog(this->CTest, DEBUG, "End" << std::endl, this->Quiet); std::string end_time = this->CTest->CurrentTime(); xml.Element("EndDateTime", end_time); - xml.Element("EndTime", static_cast<unsigned int>(cmSystemTools::GetTime())); - xml.Element( - "ElapsedMinutes", - static_cast<int>((cmSystemTools::GetTime() - elapsed_time_start) / 6) / - 10.0); + xml.Element("EndTime", std::chrono::system_clock::now()); + xml.Element("ElapsedMinutes", + std::chrono::duration_cast<std::chrono::minutes>( + std::chrono::steady_clock::now() - elapsed_time_start) + .count()); xml.StartElement("UpdateReturnStatus"); if (localModifications) { @@ -309,7 +310,7 @@ bool cmCTestUpdateHandler::SelectVCS() // If no update command was specified, lookup one for this VCS tool. if (this->UpdateCommand.empty()) { - const char* key = CM_NULLPTR; + const char* key = nullptr; switch (this->UpdateType) { case e_CVS: key = "CVSCommand"; |