summaryrefslogtreecommitdiff
path: root/Source/CTest/cmProcess.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CTest/cmProcess.h')
-rw-r--r--Source/CTest/cmProcess.h23
1 files changed, 16 insertions, 7 deletions
diff --git a/Source/CTest/cmProcess.h b/Source/CTest/cmProcess.h
index dfb02fe0d8..cbb611d5a1 100644
--- a/Source/CTest/cmProcess.h
+++ b/Source/CTest/cmProcess.h
@@ -6,9 +6,17 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include "cmsys/Process.h"
+#include <chrono>
#include <string>
#include <vector>
+/*
+ * A wrapper function for cmsysProcess_SetTimeout that takes an
+ * std::chrono::duration. For convenience only.
+ */
+void cmsysProcess_SetTimeout(cmsysProcess* process,
+ std::chrono::duration<double> timeout);
+
/** \class cmProcess
* \brief run a process with c++
*
@@ -23,8 +31,8 @@ public:
void SetCommand(const char* command);
void SetCommandArguments(std::vector<std::string> const& arg);
void SetWorkingDirectory(const char* dir) { this->WorkingDirectory = dir; }
- void SetTimeout(double t) { this->Timeout = t; }
- void ChangeTimeout(double t);
+ void SetTimeout(std::chrono::duration<double> t) { this->Timeout = t; }
+ void ChangeTimeout(std::chrono::duration<double> t);
void ResetStartTime();
// Return true if the process starts
bool StartProcess();
@@ -36,7 +44,7 @@ public:
int GetId() { return this->Id; }
void SetId(int id) { this->Id = id; }
int GetExitValue() { return this->ExitValue; }
- double GetTotalTime() { return this->TotalTime; }
+ std::chrono::duration<double> GetTotalTime() { return this->TotalTime; }
int GetExitException();
std::string GetExitExceptionString();
/**
@@ -46,12 +54,13 @@ public:
* cmsysProcess_Pipe_STDOUT = Line came from stdout or stderr
* cmsysProcess_Pipe_Timeout = Timeout expired while waiting
*/
- int GetNextOutputLine(std::string& line, double timeout);
+ int GetNextOutputLine(std::string& line,
+ std::chrono::duration<double> timeout);
private:
- double Timeout;
- double StartTime;
- double TotalTime;
+ std::chrono::duration<double> Timeout;
+ std::chrono::steady_clock::time_point StartTime;
+ std::chrono::duration<double> TotalTime;
cmsysProcess* Process;
class Buffer : public std::vector<char>
{