diff options
author | Abseil Team <absl-team@google.com> | 2022-05-31 00:46:25 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-05-31 00:47:14 -0700 |
commit | ea78ded7a5f999f19a12b71f5a4988f6f819f64f (patch) | |
tree | 519c803935c4aca1a0ed78c1264c923dc84f5871 | |
parent | f2463433d6c073381df2d9ca8c3d8f53e5ae1362 (diff) |
Automated rollback of commit f2463433d6c073381df2d9ca8c3d8f53e5ae1362.
PiperOrigin-RevId: 451979149
Change-Id: Ic9b02306f2c5324b6648989a895f128c9eb5743d
-rw-r--r-- | absl/time/time.h | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/absl/time/time.h b/absl/time/time.h index bd01867e..f284aa37 100644 --- a/absl/time/time.h +++ b/absl/time/time.h @@ -750,24 +750,23 @@ constexpr Time UnixEpoch() { return Time(); } constexpr Time UniversalEpoch() { // 719162 is the number of days from 0001-01-01 to 1970-01-01, // assuming the Gregorian calendar. - return Time( - time_internal::MakeDuration(-24 * 719162 * int64_t{3600}, uint32_t{0})); + return Time(time_internal::MakeDuration(-24 * 719162 * int64_t{3600}, 0U)); } // InfiniteFuture() // // Returns an `absl::Time` that is infinitely far in the future. constexpr Time InfiniteFuture() { - return Time(time_internal::MakeDuration((std::numeric_limits<int64_t>::max)(), - ~uint32_t{0})); + return Time( + time_internal::MakeDuration((std::numeric_limits<int64_t>::max)(), ~0U)); } // InfinitePast() // // Returns an `absl::Time` that is infinitely far in the past. constexpr Time InfinitePast() { - return Time(time_internal::MakeDuration((std::numeric_limits<int64_t>::min)(), - ~uint32_t{0})); + return Time( + time_internal::MakeDuration((std::numeric_limits<int64_t>::min)(), ~0U)); } // FromUnixNanos() @@ -1423,17 +1422,14 @@ constexpr int64_t GetRepHi(Duration d) { return d.rep_hi_; } constexpr uint32_t GetRepLo(Duration d) { return d.rep_lo_; } // Returns true iff d is positive or negative infinity. -constexpr bool IsInfiniteDuration(Duration d) { - return GetRepLo(d) == ~uint32_t{0}; -} +constexpr bool IsInfiniteDuration(Duration d) { return GetRepLo(d) == ~0U; } // Returns an infinite Duration with the opposite sign. // REQUIRES: IsInfiniteDuration(d) constexpr Duration OppositeInfinity(Duration d) { return GetRepHi(d) < 0 - ? MakeDuration((std::numeric_limits<int64_t>::max)(), ~uint32_t{0}) - : MakeDuration((std::numeric_limits<int64_t>::min)(), - ~uint32_t{0}); + ? MakeDuration((std::numeric_limits<int64_t>::max)(), ~0U) + : MakeDuration((std::numeric_limits<int64_t>::min)(), ~0U); } // Returns (-n)-1 (equivalently -(n+1)) without avoidable overflow. @@ -1572,7 +1568,7 @@ constexpr Duration operator-(Duration d) { constexpr Duration InfiniteDuration() { return time_internal::MakeDuration((std::numeric_limits<int64_t>::max)(), - ~uint32_t{0}); + ~0U); } constexpr Duration FromChrono(const std::chrono::nanoseconds& d) { |