diff options
author | Wouter Klouwen <wouter.klouwen@youview.com> | 2017-11-15 18:00:09 (GMT) |
---|---|---|
committer | Wouter Klouwen <wouter.klouwen@youview.com> | 2017-11-17 15:22:55 (GMT) |
commit | 5fd979a8a3bc13aaf20c2833fe513df192d82fb1 (patch) | |
tree | 4a99189a6f387c43f92707645dcb0cfacb3d17ad /Source/CTest/cmCTestBuildHandler.cxx | |
parent | e31288582977c10972af9baa3b0e41d758094d21 (diff) | |
download | CMake-5fd979a8a3bc13aaf20c2833fe513df192d82fb1.zip CMake-5fd979a8a3bc13aaf20c2833fe513df192d82fb1.tar.gz CMake-5fd979a8a3bc13aaf20c2833fe513df192d82fb1.tar.bz2 |
CTest: adopt std::chrono::system_clock
After the refactor to make CTest use std::chrono::steady_clock for the
keeping of time for test duration, there are still references to
cmSystemTools::GetTime() left.
To further adopt std::chrono for time related activities, this commit
changes those remaining references to std::chrono::system_clock::now()
calls and alters the storage from either unsigned int or double to
std::chrono::system_clock::time_point.
For ease of conversion, a converter method is added to cmXMLWriter that
converts from a std::chrono::system_clock::time_point to the number of
seconds since the UN*X epoch as that is expected behaviour. This means
no more casts as required.
Functionally should be no difference as the system_clock is implemented
in the same terms.
Diffstat (limited to 'Source/CTest/cmCTestBuildHandler.cxx')
-rw-r--r-- | Source/CTest/cmCTestBuildHandler.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 4ad4831..f25c9c3 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -407,7 +407,7 @@ int cmCTestBuildHandler::ProcessHandler() // Remember start build time this->StartBuild = this->CTest->CurrentTime(); - this->StartBuildTime = cmSystemTools::GetTime(); + this->StartBuildTime = std::chrono::system_clock::now(); int retVal = 0; int res = cmsysProcess_State_Exited; if (!this->CTest->GetShowOnly()) { @@ -421,7 +421,7 @@ int cmCTestBuildHandler::ProcessHandler() // Remember end build time and calculate elapsed time this->EndBuild = this->CTest->CurrentTime(); - this->EndBuildTime = cmSystemTools::GetTime(); + this->EndBuildTime = std::chrono::system_clock::now(); auto elapsed_build_time = std::chrono::steady_clock::now() - elapsed_time_start; @@ -488,8 +488,7 @@ void cmCTestBuildHandler::GenerateXMLHeader(cmXMLWriter& xml) this->CTest->GenerateSubprojectsOutput(xml); xml.StartElement("Build"); xml.Element("StartDateTime", this->StartBuild); - xml.Element("StartBuildTime", - static_cast<unsigned int>(this->StartBuildTime)); + xml.Element("StartBuildTime", this->StartBuildTime); xml.Element("BuildCommand", this->GetMakeCommand()); } @@ -644,7 +643,7 @@ void cmCTestBuildHandler::GenerateXMLFooter( xml.EndElement(); // Log xml.Element("EndDateTime", this->EndBuild); - xml.Element("EndBuildTime", static_cast<unsigned int>(this->EndBuildTime)); + xml.Element("EndBuildTime", this->EndBuildTime); xml.Element( "ElapsedMinutes", std::chrono::duration_cast<std::chrono::minutes>(elapsed_build_time) |