From 082c006c04343a78d87b6c6ab3608c25d6213c3f Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 21 Nov 2020 14:43:54 +0100 Subject: merge(3p/absl): subtree merge of Abseil up to e19260f ... notably, this includes Abseil's own StatusOr type, which conflicted with our implementation (that was taken from TensorFlow). Change-Id: Ie7d6764b64055caaeb8dc7b6b9d066291e6b538f --- .../internal/cctz/include/cctz/civil_time_detail.h | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'third_party/abseil_cpp/absl/time/internal/cctz/include') diff --git a/third_party/abseil_cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h b/third_party/abseil_cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h index d1b4222b1f43..8aadde57ca72 100644 --- a/third_party/abseil_cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h +++ b/third_party/abseil_cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h @@ -416,16 +416,10 @@ class civil_time { // Assigning arithmetic. CONSTEXPR_M civil_time& operator+=(diff_t n) noexcept { - f_ = step(T{}, f_, n); - return *this; + return *this = *this + n; } CONSTEXPR_M civil_time& operator-=(diff_t n) noexcept { - if (n != (std::numeric_limits::min)()) { - f_ = step(T{}, f_, -n); - } else { - f_ = step(T{}, step(T{}, f_, -(n + 1)), 1); - } - return *this; + return *this = *this - n; } CONSTEXPR_M civil_time& operator++() noexcept { return *this += 1; } CONSTEXPR_M civil_time operator++(int) noexcept { @@ -442,13 +436,15 @@ class civil_time { // Binary arithmetic operators. friend CONSTEXPR_F civil_time operator+(civil_time a, diff_t n) noexcept { - return a += n; + return civil_time(step(T{}, a.f_, n)); } friend CONSTEXPR_F civil_time operator+(diff_t n, civil_time a) noexcept { - return a += n; + return a + n; } friend CONSTEXPR_F civil_time operator-(civil_time a, diff_t n) noexcept { - return a -= n; + return n != (std::numeric_limits::min)() + ? civil_time(step(T{}, a.f_, -n)) + : civil_time(step(T{}, step(T{}, a.f_, -(n + 1)), 1)); } friend CONSTEXPR_F diff_t operator-(civil_time lhs, civil_time rhs) noexcept { return difference(T{}, lhs.f_, rhs.f_); -- cgit 1.4.1