#ifndef H_ProgressTimer #define H_ProgressTimer #include #include /// @brief This class implements a progress timer that predicts how long a loop will take to complete. class ProgressTimer { public: /// @brief Creates a new progress timer. /// @param num_iterations Number of iterations to perform. ProgressTimer(size_t num_iterations); /// @brief Increments the iteration counter and prints the progress. /// @return A string with the current progress. std::string increment(); /// @brief Converts a number of seconds to a string with hours, minutes and seconds. /// @param seconds Total number of seconds (input). /// @return "hh:mm:ss.uuuuuu" static std::string seconds_to_hms_str(double seconds); private: std::chrono::steady_clock::time_point m_start; size_t m_num_iterations; size_t m_current_iteration; }; #endif