Commit 0f9a5c37 authored by Emmanuelle Sarrazin's avatar Emmanuelle Sarrazin

BUG: Add missing file for issue #763

parent 5e8050cf
......@@ -19,6 +19,8 @@
*/
#include <chrono>
#include <sstream>
#include <iomanip>
#include "otbStopwatch.h"
......@@ -82,6 +84,25 @@ Stopwatch
return result;
}
std::string
Stopwatch
::GetElapsedHumanReadableTime() const
{
auto result = this->GetElapsedMilliseconds();
int seconds = result/1000;
int hours = seconds / 3600;
seconds -= (hours * 3600);
int minutes = seconds / 60;
seconds -= (minutes * 60);
std::ostringstream os;
if (hours > 0)
os << hours << "h " << std::setfill('0') << std::setw(2);
if (minutes > 0 or hours>0)
os << minutes << "m " << std::setfill('0') << std::setw(2);
os << seconds << "s";
return os.str();
}
bool
Stopwatch
::IsRunning() const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment