From e219008320201ddbb0295daeed7a2e5c8ab2e83e Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Fri, 14 Feb 2014 11:13:45 -0800 Subject: [PATCH] Make abstract_clock members const --- beast/chrono/abstract_clock.h | 12 ++++++------ beast/chrono/manual_clock.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/beast/chrono/abstract_clock.h b/beast/chrono/abstract_clock.h index d150d267c..170e663a7 100644 --- a/beast/chrono/abstract_clock.h +++ b/beast/chrono/abstract_clock.h @@ -72,15 +72,15 @@ public: virtual bool is_steady () const = 0; /** Returns the current time. */ - virtual time_point now () = 0; + virtual time_point now () const = 0; /** Convert the specified time point to a string. */ /** @{ */ - virtual std::string to_string (time_point const& tp) = 0; + virtual std::string to_string (time_point const& tp) const = 0; template std::string to_string ( - std::chrono::time_point const& tp) + std::chrono::time_point const& tp) const { return to_string ( std::chrono::time_point_cast (tp)); @@ -88,7 +88,7 @@ public: /** @} */ /** Returning elapsed ticks since the epoch. */ - rep elapsed () + rep elapsed () const { return now().time_since_epoch().count(); } @@ -109,7 +109,7 @@ struct basic_abstract_clock_wrapper : public abstract_clock return TrivialClock::is_steady; } - time_point now () + time_point now () const { return time_point (duration ( std::chrono::duration_cast ( @@ -123,7 +123,7 @@ struct abstract_clock_wrapper { // generic conversion displays the duration std::string to_string (typename basic_abstract_clock_wrapper < - TrivialClock, Duration>::time_point const& tp) + TrivialClock, Duration>::time_point const& tp) const { std::stringstream ss; ss << tp.time_since_epoch(); diff --git a/beast/chrono/manual_clock.h b/beast/chrono/manual_clock.h index 032be6130..ad373725c 100644 --- a/beast/chrono/manual_clock.h +++ b/beast/chrono/manual_clock.h @@ -48,12 +48,12 @@ public: return IsSteady; } - time_point now () + time_point now () const { return m_now; } - std::string to_string (time_point const& tp) + std::string to_string (time_point const& tp) const { std::stringstream ss; ss << tp.time_since_epoch() << " from start";