From d4592bd49794481aefb9a2efe6c112f578f0c4f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Kami=C5=84ski?= Date: Fri, 24 Nov 2017 23:20:39 +0100 Subject: [PATCH] Maked clock_time_conversion as const and used alias. Marked operator() of all supplied clock_time_conversion overload as const. Changed input type to sys_time/utc_time alias when possible. Used consitient nomencalture: st for sys_time, ut for utc_time and tp for time in different clock. --- include/date/tz.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/include/date/tz.h b/include/date/tz.h index db39880..0589a6f 100644 --- a/include/date/tz.h +++ b/include/date/tz.h @@ -2205,8 +2205,8 @@ template<> struct clock_time_conversion { template - auto operator()(const std::chrono::time_point& st) - -> std::chrono::time_point + auto operator()(const sys_time& st) const + -> sys_time { return st; } @@ -2216,10 +2216,10 @@ template<> struct clock_time_conversion { template - auto operator()(const std::chrono::time_point& st) - -> std::chrono::time_point + auto operator()(const utc_time& ut) const + -> utc_time { - return st; + return ut; } }; @@ -2249,17 +2249,17 @@ template struct clock_time_conversion { template - auto operator()(const std::chrono::time_point& st) + auto operator()(const std::chrono::time_point& tp) const -> std::chrono::time_point { - return st; + return tp; } }; namespace ctc_detail { //Check if TimePoint is time for given clock, - //if not emits hard errorf + //if not emits hard error template struct return_clock_time { @@ -2314,10 +2314,10 @@ template struct clock_time_conversion { template - auto operator()(const std::chrono::time_point& st) + auto operator()(const std::chrono::time_point& tp) const -> typename ctc_detail::return_to_sys::type { - return SourceClock::to_sys(st); + return SourceClock::to_sys(tp); } }; @@ -2325,7 +2325,7 @@ template struct clock_time_conversion { template - auto operator()(const std::chrono::time_point& st) + auto operator()(const sys_time& st) const -> typename ctc_detail::return_from_sys::type { return DestClock::from_sys(st); @@ -2336,10 +2336,10 @@ template struct clock_time_conversion { template - auto operator()(const std::chrono::time_point& st) + auto operator()(const std::chrono::time_point& tp) const -> typename ctc_detail::return_to_utc::type { - return SourceClock::to_utc(st); + return SourceClock::to_utc(tp); } }; @@ -2347,7 +2347,7 @@ template struct clock_time_conversion { template - auto operator()(const std::chrono::time_point& ut) + auto operator()(const utc_time& ut) const -> typename ctc_detail::return_from_utc::type { return DestClock::from_utc(ut);