std::string Timer::elapsedTime() const { auto dur(end_ - start_); std::ostringstream sout; Hours hours = std::chrono::duration_cast<Hours>(dur); dur -= hours; Minutes minutes = std::chrono::duration_cast<Minutes>(dur); dur -= minutes; Seconds seconds = std::chrono::duration_cast<Seconds>(dur); sout << hours.count() << ":" << minutes.count() << ":" << seconds.count(); return sout.str(); }
std::string Timer::elapsedCpuTime(const Communicator &comm) const { std::chrono::duration<double, std::nano> dur(comm.sum((end_ - start_).count())); std::ostringstream sout; Hours hours = std::chrono::duration_cast<Hours>(dur); dur -= hours; Minutes minutes = std::chrono::duration_cast<Minutes>(dur); dur -= minutes; Seconds seconds = std::chrono::duration_cast<Seconds>(dur); sout << hours.count() << ":" << minutes.count() << ":" << seconds.count(); return sout.str(); }
inline void Formatter(FormatData& formatData, const Minutes& minutes) { Formatter(formatData, minutes.count()); formatData.string.append(U"min", 3); }