16using namespace boost::posix_time;
20 last_start_(getCurrentTime()),
21 last_stop_(last_start_),
22 cumulative_time_(microseconds(0)) {
43 cumulative_time_ += last_stop_ - last_start_;
54 last_stop_ = last_start_;
56 cumulative_time_ = microseconds(0);
66 return (end_time - last_start_);
72 time_duration total_duration = cumulative_time_;
78 return (total_duration);
84 if (duration.total_seconds() > 0) {
85 s << duration.total_seconds() <<
"."
86 << std::setfill(
'0') << std::setw(2) << (duration.total_milliseconds()/10 % 100)
89 s << duration.total_milliseconds() <<
".";
90 s << std::setfill(
'0') << std::setw(3) << (duration.total_microseconds() % 1000)
98 return (microsec_clock::universal_time());
void start()
Starts the stopwatch.
virtual ~StopwatchImpl()
Virtual destructor.
boost::posix_time::time_duration getTotalDuration() const
Retrieves the total measured duration.
static std::string logFormat(const boost::posix_time::time_duration &duration)
Returns the duration in the textual format which can be directly used in log messages.
StopwatchImpl()
Constructor.
void reset()
Reset the stopwatch.
virtual boost::posix_time::ptime getCurrentTime() const
Returns the current time.
void stop()
Stop the stopwatch.
boost::posix_time::time_duration getLastDuration() const
Retrieves the measured duration.
Defines the logger used by the top-level component of kea-lfc.