From 6a4d93a0bd8b56db68821067322c09ec37d0d8a9 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Sun, 1 Jul 2018 23:00:33 -0400 Subject: [PATCH] Silence more shadow warnings --- include/date/tz.h | 46 ++++++++++++++++++------------------ test/date_test/year.pass.cpp | 2 +- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/include/date/tz.h b/include/date/tz.h index 48aca6f..71c37e6 100644 --- a/include/date/tz.h +++ b/include/date/tz.h @@ -1887,10 +1887,10 @@ utc_time::type> utc_clock::from_sys(const sys_time& st) { using namespace std::chrono; - using duration = typename std::common_type::type; + using CD = typename std::common_type::type; auto const& leaps = get_tzdb().leaps; auto const lt = std::upper_bound(leaps.begin(), leaps.end(), st); - return utc_time{st.time_since_epoch() + seconds{lt-leaps.begin()}}; + return utc_time{st.time_since_epoch() + seconds{lt-leaps.begin()}}; } // Return pair @@ -1927,11 +1927,11 @@ sys_time::type> utc_clock::to_sys(const utc_time& ut) { using namespace std::chrono; - using duration = typename std::common_type::type; + using CD = typename std::common_type::type; auto ls = is_leap_second(ut); - auto tp = sys_time{ut.time_since_epoch() - ls.second}; + auto tp = sys_time{ut.time_since_epoch() - ls.second}; if (ls.first) - tp = floor(tp) + seconds{1} - duration{1}; + tp = floor(tp) + seconds{1} - CD{1}; return tp; } @@ -1954,8 +1954,8 @@ template local_time::type> utc_clock::to_local(const utc_time& ut) { - using duration = typename std::common_type::type; - return local_time{to_sys(ut).time_since_epoch()}; + using CD = typename std::common_type::type; + return local_time{to_sys(ut).time_since_epoch()}; } template @@ -2065,8 +2065,8 @@ utc_time::type> tai_clock::to_utc(const tai_time& t) NOEXCEPT { using namespace std::chrono; - using duration = typename std::common_type::type; - return utc_time{t.time_since_epoch()} - + using CD = typename std::common_type::type; + return utc_time{t.time_since_epoch()} - (sys_days(year{1970}/January/1) - sys_days(year{1958}/January/1) + seconds{10}); } @@ -2076,8 +2076,8 @@ tai_time::type> tai_clock::from_utc(const utc_time& t) NOEXCEPT { using namespace std::chrono; - using duration = typename std::common_type::type; - return tai_time{t.time_since_epoch()} + + using CD = typename std::common_type::type; + return tai_time{t.time_since_epoch()} + (sys_days(year{1970}/January/1) - sys_days(year{1958}/January/1) + seconds{10}); } @@ -2094,8 +2094,8 @@ inline local_time::type> tai_clock::to_local(const tai_time& t) NOEXCEPT { - using duration = typename std::common_type::type; - return local_time{t.time_since_epoch()} - + using CD = typename std::common_type::type; + return local_time{t.time_since_epoch()} - (local_days(year{1970}/January/1) - local_days(year{1958}/January/1)); } @@ -2104,8 +2104,8 @@ inline tai_time::type> tai_clock::from_local(const local_time& t) NOEXCEPT { - using duration = typename std::common_type::type; - return tai_time{t.time_since_epoch()} + + using CD = typename std::common_type::type; + return tai_time{t.time_since_epoch()} + (local_days(year{1970}/January/1) - local_days(year{1958}/January/1)); } @@ -2186,8 +2186,8 @@ utc_time::type> gps_clock::to_utc(const gps_time& t) NOEXCEPT { using namespace std::chrono; - using duration = typename std::common_type::type; - return utc_time{t.time_since_epoch()} + + using CD = typename std::common_type::type; + return utc_time{t.time_since_epoch()} + (sys_days(year{1980}/January/Sunday[1]) - sys_days(year{1970}/January/1) + seconds{9}); } @@ -2198,8 +2198,8 @@ gps_time::type> gps_clock::from_utc(const utc_time& t) NOEXCEPT { using namespace std::chrono; - using duration = typename std::common_type::type; - return gps_time{t.time_since_epoch()} - + using CD = typename std::common_type::type; + return gps_time{t.time_since_epoch()} - (sys_days(year{1980}/January/Sunday[1]) - sys_days(year{1970}/January/1) + seconds{9}); } @@ -2217,8 +2217,8 @@ inline local_time::type> gps_clock::to_local(const gps_time& t) NOEXCEPT { - using duration = typename std::common_type::type; - return local_time{t.time_since_epoch()} + + using CD = typename std::common_type::type; + return local_time{t.time_since_epoch()} + (local_days(year{1980}/January/Sunday[1]) - local_days(year{1970}/January/1)); } @@ -2227,8 +2227,8 @@ inline gps_time::type> gps_clock::from_local(const local_time& t) NOEXCEPT { - using duration = typename std::common_type::type; - return gps_time{t.time_since_epoch()} - + using CD = typename std::common_type::type; + return gps_time{t.time_since_epoch()} - (local_days(year{1980}/January/Sunday[1]) - local_days(year{1970}/January/1)); } diff --git a/test/date_test/year.pass.cpp b/test/date_test/year.pass.cpp index 27d9df6..585a245 100644 --- a/test/date_test/year.pass.cpp +++ b/test/date_test/year.pass.cpp @@ -107,7 +107,7 @@ main() static_assert(year::max().ok(), ""); #if __cplusplus >= 201402 - using int64_t = std::int64_t; + using std::int64_t; static_assert(sys_days(year::min()/jan/1) - sys_days(1970_y/jan/1) >= as(days::min()), ""); static_assert(sys_days(year::min()/jan/1) - sys_days(1970_y/jan/1)