修改pods
This commit is contained in:
102
Pods/abseil/absl/time/time.h
generated
102
Pods/abseil/absl/time/time.h
generated
@@ -75,15 +75,22 @@
|
||||
struct timeval;
|
||||
#endif
|
||||
#include <chrono> // NOLINT(build/c++11)
|
||||
|
||||
#ifdef __cpp_impl_three_way_comparison
|
||||
#include <compare>
|
||||
#endif // __cpp_impl_three_way_comparison
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <ctime>
|
||||
#include <limits>
|
||||
#include <ostream>
|
||||
#include <ratio> // NOLINT(build/c++11)
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/base/attributes.h"
|
||||
#include "absl/base/config.h"
|
||||
#include "absl/base/macros.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
@@ -98,7 +105,6 @@ class Time; // Defined below
|
||||
class TimeZone; // Defined below
|
||||
|
||||
namespace time_internal {
|
||||
int64_t IDivDuration(bool satq, Duration num, Duration den, Duration* rem);
|
||||
ABSL_ATTRIBUTE_CONST_FUNCTION constexpr Time FromUnixDuration(Duration d);
|
||||
ABSL_ATTRIBUTE_CONST_FUNCTION constexpr Duration ToUnixDuration(Time t);
|
||||
ABSL_ATTRIBUTE_CONST_FUNCTION constexpr int64_t GetRepHi(Duration d);
|
||||
@@ -306,6 +312,14 @@ class Duration {
|
||||
};
|
||||
|
||||
// Relational Operators
|
||||
|
||||
#ifdef __cpp_impl_three_way_comparison
|
||||
|
||||
ABSL_ATTRIBUTE_CONST_FUNCTION constexpr std::strong_ordering operator<=>(
|
||||
Duration lhs, Duration rhs);
|
||||
|
||||
#endif // __cpp_impl_three_way_comparison
|
||||
|
||||
ABSL_ATTRIBUTE_CONST_FUNCTION constexpr bool operator<(Duration lhs,
|
||||
Duration rhs);
|
||||
ABSL_ATTRIBUTE_CONST_FUNCTION constexpr bool operator>(Duration lhs,
|
||||
@@ -338,30 +352,6 @@ ABSL_ATTRIBUTE_CONST_FUNCTION inline Duration operator-(Duration lhs,
|
||||
return lhs -= rhs;
|
||||
}
|
||||
|
||||
// Multiplicative Operators
|
||||
// Integer operands must be representable as int64_t.
|
||||
template <typename T>
|
||||
ABSL_ATTRIBUTE_CONST_FUNCTION Duration operator*(Duration lhs, T rhs) {
|
||||
return lhs *= rhs;
|
||||
}
|
||||
template <typename T>
|
||||
ABSL_ATTRIBUTE_CONST_FUNCTION Duration operator*(T lhs, Duration rhs) {
|
||||
return rhs *= lhs;
|
||||
}
|
||||
template <typename T>
|
||||
ABSL_ATTRIBUTE_CONST_FUNCTION Duration operator/(Duration lhs, T rhs) {
|
||||
return lhs /= rhs;
|
||||
}
|
||||
ABSL_ATTRIBUTE_CONST_FUNCTION inline int64_t operator/(Duration lhs,
|
||||
Duration rhs) {
|
||||
return time_internal::IDivDuration(true, lhs, rhs,
|
||||
&lhs); // trunc towards zero
|
||||
}
|
||||
ABSL_ATTRIBUTE_CONST_FUNCTION inline Duration operator%(Duration lhs,
|
||||
Duration rhs) {
|
||||
return lhs %= rhs;
|
||||
}
|
||||
|
||||
// IDivDuration()
|
||||
//
|
||||
// Divides a numerator `Duration` by a denominator `Duration`, returning the
|
||||
@@ -390,10 +380,7 @@ ABSL_ATTRIBUTE_CONST_FUNCTION inline Duration operator%(Duration lhs,
|
||||
// // Here, q would overflow int64_t, so rem accounts for the difference.
|
||||
// int64_t q = absl::IDivDuration(a, b, &rem);
|
||||
// // q == std::numeric_limits<int64_t>::max(), rem == a - b * q
|
||||
inline int64_t IDivDuration(Duration num, Duration den, Duration* rem) {
|
||||
return time_internal::IDivDuration(true, num, den,
|
||||
rem); // trunc towards zero
|
||||
}
|
||||
int64_t IDivDuration(Duration num, Duration den, Duration* rem);
|
||||
|
||||
// FDivDuration()
|
||||
//
|
||||
@@ -409,6 +396,30 @@ inline int64_t IDivDuration(Duration num, Duration den, Duration* rem) {
|
||||
// // d == 1.5
|
||||
ABSL_ATTRIBUTE_CONST_FUNCTION double FDivDuration(Duration num, Duration den);
|
||||
|
||||
// Multiplicative Operators
|
||||
// Integer operands must be representable as int64_t.
|
||||
template <typename T>
|
||||
ABSL_ATTRIBUTE_CONST_FUNCTION Duration operator*(Duration lhs, T rhs) {
|
||||
return lhs *= rhs;
|
||||
}
|
||||
template <typename T>
|
||||
ABSL_ATTRIBUTE_CONST_FUNCTION Duration operator*(T lhs, Duration rhs) {
|
||||
return rhs *= lhs;
|
||||
}
|
||||
template <typename T>
|
||||
ABSL_ATTRIBUTE_CONST_FUNCTION Duration operator/(Duration lhs, T rhs) {
|
||||
return lhs /= rhs;
|
||||
}
|
||||
ABSL_ATTRIBUTE_CONST_FUNCTION inline int64_t operator/(Duration lhs,
|
||||
Duration rhs) {
|
||||
return IDivDuration(lhs, rhs,
|
||||
&lhs); // trunc towards zero
|
||||
}
|
||||
ABSL_ATTRIBUTE_CONST_FUNCTION inline Duration operator%(Duration lhs,
|
||||
Duration rhs) {
|
||||
return lhs %= rhs;
|
||||
}
|
||||
|
||||
// ZeroDuration()
|
||||
//
|
||||
// Returns a zero-length duration. This function behaves just like the default
|
||||
@@ -841,6 +852,11 @@ class Time {
|
||||
private:
|
||||
friend constexpr Time time_internal::FromUnixDuration(Duration d);
|
||||
friend constexpr Duration time_internal::ToUnixDuration(Time t);
|
||||
|
||||
#ifdef __cpp_impl_three_way_comparison
|
||||
friend constexpr std::strong_ordering operator<=>(Time lhs, Time rhs);
|
||||
#endif // __cpp_impl_three_way_comparison
|
||||
|
||||
friend constexpr bool operator<(Time lhs, Time rhs);
|
||||
friend constexpr bool operator==(Time lhs, Time rhs);
|
||||
friend Duration operator-(Time lhs, Time rhs);
|
||||
@@ -852,6 +868,15 @@ class Time {
|
||||
};
|
||||
|
||||
// Relational Operators
|
||||
#ifdef __cpp_impl_three_way_comparison
|
||||
|
||||
ABSL_ATTRIBUTE_CONST_FUNCTION constexpr std::strong_ordering operator<=>(
|
||||
Time lhs, Time rhs) {
|
||||
return lhs.rep_ <=> rhs.rep_;
|
||||
}
|
||||
|
||||
#endif // __cpp_impl_three_way_comparison
|
||||
|
||||
ABSL_ATTRIBUTE_CONST_FUNCTION constexpr bool operator<(Time lhs, Time rhs) {
|
||||
return lhs.rep_ < rhs.rep_;
|
||||
}
|
||||
@@ -1727,6 +1752,25 @@ ABSL_ATTRIBUTE_CONST_FUNCTION constexpr bool operator<(Duration lhs,
|
||||
: time_internal::GetRepLo(lhs) < time_internal::GetRepLo(rhs);
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cpp_impl_three_way_comparison
|
||||
|
||||
ABSL_ATTRIBUTE_CONST_FUNCTION constexpr std::strong_ordering operator<=>(
|
||||
Duration lhs, Duration rhs) {
|
||||
const int64_t lhs_hi = time_internal::GetRepHi(lhs);
|
||||
const int64_t rhs_hi = time_internal::GetRepHi(rhs);
|
||||
if (auto c = lhs_hi <=> rhs_hi; c != std::strong_ordering::equal) {
|
||||
return c;
|
||||
}
|
||||
const uint32_t lhs_lo = time_internal::GetRepLo(lhs);
|
||||
const uint32_t rhs_lo = time_internal::GetRepLo(rhs);
|
||||
return (lhs_hi == (std::numeric_limits<int64_t>::min)())
|
||||
? (lhs_lo + 1) <=> (rhs_lo + 1)
|
||||
: lhs_lo <=> rhs_lo;
|
||||
}
|
||||
|
||||
#endif // __cpp_impl_three_way_comparison
|
||||
|
||||
ABSL_ATTRIBUTE_CONST_FUNCTION constexpr bool operator==(Duration lhs,
|
||||
Duration rhs) {
|
||||
return time_internal::GetRepHi(lhs) == time_internal::GetRepHi(rhs) &&
|
||||
|
||||
Reference in New Issue
Block a user