diff --git a/Firestore/core/include/firebase/firestore/timestamp.h b/Firestore/core/include/firebase/firestore/timestamp.h index 0ab818532f8..f3f2c3426b7 100644 --- a/Firestore/core/include/firebase/firestore/timestamp.h +++ b/Firestore/core/include/firebase/firestore/timestamp.h @@ -19,12 +19,10 @@ #include #include -#include -#include -#if !defined(_STLPORT_VERSION) #include // NOLINT(build/c++11) -#endif // !defined(_STLPORT_VERSION) +#include +#include namespace firebase { @@ -117,7 +115,6 @@ class Timestamp { */ static Timestamp FromTimeT(time_t seconds_since_unix_epoch); -#if !defined(_STLPORT_VERSION) /** * Converts `std::chrono::time_point` to a `Timestamp`. * @@ -145,7 +142,6 @@ class Timestamp { template std::chrono::time_point ToTimePoint() const; -#endif // !defined(_STLPORT_VERSION) /** * Returns a string representation of this `Timestamp` for logging/debugging @@ -205,8 +201,6 @@ inline bool operator==(const Timestamp& lhs, const Timestamp& rhs) { return !(lhs != rhs); } -#if !defined(_STLPORT_VERSION) - // Make sure the header compiles even when included after `` without // `NOMINMAX` defined. `push/pop_macro` pragmas are supported by Visual Studio // as well as Clang and GCC. @@ -239,8 +233,6 @@ std::chrono::time_point Timestamp::ToTimePoint() const { #pragma pop_macro("max") #pragma pop_macro("min") -#endif // !defined(_STLPORT_VERSION) - } // namespace firebase #endif // FIRESTORE_CORE_INCLUDE_FIREBASE_FIRESTORE_TIMESTAMP_H_ diff --git a/Firestore/core/src/timestamp.cc b/Firestore/core/src/timestamp.cc index 1b60605c7a8..108bf1d75be 100644 --- a/Firestore/core/src/timestamp.cc +++ b/Firestore/core/src/timestamp.cc @@ -20,8 +20,6 @@ #if defined(__APPLE__) #import -#elif defined(_STLPORT_VERSION) -#include #endif #include "Firestore/core/src/util/hard_assert.h" @@ -76,29 +74,16 @@ Timestamp Timestamp::Now() { auto nanos = static_cast(fraction * kNanosPerSecond); return MakeNormalizedTimestamp(seconds, nanos); -#elif !defined(_STLPORT_VERSION) - // Use the standard library from C++11 if possible. - return FromTimePoint(std::chrono::system_clock::now()); #else - // If is unavailable, use clock_gettime from POSIX, which supports - // up to nanosecond resolution. Note that it's a non-standard function - // contained in . - // - // Note: it's possible to check for availability of POSIX clock_gettime using - // macros (see "Availability" at https://linux.die.net/man/3/clock_gettime). - // However, the only platform where isn't available is Android with - // STLPort standard library, where clock_gettime is known to be available. - timespec now; - clock_gettime(CLOCK_REALTIME, &now); - return MakeNormalizedTimestamp(now.tv_sec, now.tv_nsec); -#endif // !defined(_STLPORT_VERSION) + // Use the standard library from C++11. + return FromTimePoint(std::chrono::system_clock::now()); +#endif } Timestamp Timestamp::FromTimeT(const time_t seconds_since_unix_epoch) { return {seconds_since_unix_epoch, 0}; } -#if !defined(_STLPORT_VERSION) Timestamp Timestamp::FromTimePoint( const std::chrono::time_point time_point) { namespace chr = std::chrono; @@ -111,8 +96,6 @@ Timestamp Timestamp::FromTimePoint( return result; } -#endif // !defined(_STLPORT_VERSION) - std::string Timestamp::ToString() const { return absl::StrCat("Timestamp(seconds=", seconds_, ", nanoseconds=", nanoseconds_, ")"); diff --git a/Firestore/core/src/util/firestore_exceptions.h b/Firestore/core/src/util/firestore_exceptions.h index dc70229b737..1d5b5d44854 100644 --- a/Firestore/core/src/util/firestore_exceptions.h +++ b/Firestore/core/src/util/firestore_exceptions.h @@ -27,26 +27,11 @@ #include "Firestore/core/include/firebase/firestore/firestore_errors.h" -#if defined(__ANDROID__) -// Abseil does not support STLPort, so avoid their config.h here. -// -// TODO(b/163140650): Remove once the Firebase support floor moves to NDK R18. -// -// Meanwhile, NDK R16b (the current minimum) includes Clang 5.0.3 and GCC 4.9. -// While Clang supports `__cpp_exceptions` at that version, GCC does not. Both -// support `__EXCEPTIONS`. -#if __EXCEPTIONS -#define FIRESTORE_HAVE_EXCEPTIONS 1 -#endif - -#else // !defined(__ANDROID__) -// On any other supported platform, just take Abseil's word for it. #include "absl/base/config.h" #if ABSL_HAVE_EXCEPTIONS #define FIRESTORE_HAVE_EXCEPTIONS 1 #endif -#endif // defined(__ANDROID__) namespace firebase { namespace firestore {