21using bestSteadyClock = std::conditional_t<std::chrono::high_resolution_clock::is_steady,
22 std::chrono::high_resolution_clock, std::chrono::steady_clock>;
67 static std::string
getDateStamp(
const std::string &format =
"%Y-%m-%d_%H-%M-%S") {
68 auto now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
69 std::ostringstream nowStrStr;
72 ss << std::put_time(localtime_r(&now, &unused), format.c_str());
80 bestSteadyClock::time_point _startTime;
90 bool _currentlyRunning =
false;
Timer class to stop times.
Definition: Timer.h:27
void start()
start the timer.
Definition: Timer.cpp:17
void reset()
Resets the timer to 0.
Definition: Timer.cpp:40
long getTotalTime() const
Get total accumulated time.
Definition: Timer.h:60
static std::string getDateStamp(const std::string &format="%Y-%m-%d_%H-%M-%S")
Create a date stamp for the current moment with the given format.
Definition: Timer.h:67
void addTime(long nanoseconds)
Adds the given amount of nanoseconds to the total time.
Definition: Timer.cpp:42
long stop()
Stops the timer and returns the time elapsed in nanoseconds since the last call to start.
Definition: Timer.cpp:25
In this namespace some helper classes and functions can be found used inside of AutoPas.
Definition: namespaces.h:44
std::conditional_t< std::chrono::high_resolution_clock::is_steady, std::chrono::high_resolution_clock, std::chrono::steady_clock > bestSteadyClock
high_resolution_clock is not guaranteed to be monotonous in time, which can lead to negative duration...
Definition: Timer.h:22