diff options
author | Gil <mcg@google.com> | 2018-05-22 13:21:08 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-22 13:21:08 -0700 |
commit | d439bbccd4b90583a89d209d2cc81308aabca8ac (patch) | |
tree | 13fb14cc905f667e1470bcc14a3c84dfb6a7a109 /Firestore/core/src/firebase/firestore/timestamp.cc | |
parent | 476be0ba2ba8340296a5b5b05f27f3ded4bd6c72 (diff) |
Add a HARD_ASSERT C++ assertion macro (#1304)
* Add HARD_ASSERT
* Use HARD_ASSERT
* Remove FIREBASE_ASSERT
* Remove StringPrintf
Diffstat (limited to 'Firestore/core/src/firebase/firestore/timestamp.cc')
-rw-r--r-- | Firestore/core/src/firebase/firestore/timestamp.cc | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/Firestore/core/src/firebase/firestore/timestamp.cc b/Firestore/core/src/firebase/firestore/timestamp.cc index a5f0121..c35fca1 100644 --- a/Firestore/core/src/firebase/firestore/timestamp.cc +++ b/Firestore/core/src/firebase/firestore/timestamp.cc @@ -16,7 +16,7 @@ #include "Firestore/core/include/firebase/firestore/timestamp.h" -#include "Firestore/core/src/firebase/firestore/util/firebase_assert.h" +#include "Firestore/core/src/firebase/firestore/util/hard_assert.h" namespace firebase { @@ -58,7 +58,7 @@ Timestamp Timestamp::FromTimePoint( const auto epoch_time = time_point.time_since_epoch(); auto seconds = chr::duration_cast<chr::duration<int64_t>>(epoch_time); auto nanoseconds = chr::duration_cast<chr::nanoseconds>(epoch_time - seconds); - FIREBASE_DEV_ASSERT(nanoseconds.count() < 1 * 1000 * 1000 * 1000); + HARD_ASSERT(nanoseconds.count() < 1 * 1000 * 1000 * 1000); if (nanoseconds.count() < 0) { // Timestamp format always has a positive number of nanoseconds that is @@ -89,19 +89,17 @@ std::string Timestamp::ToString() const { } void Timestamp::ValidateBounds() const { - FIREBASE_ASSERT_MESSAGE(nanoseconds_ >= 0, - "Timestamp nanoseconds out of range: %d", - nanoseconds_); - FIREBASE_ASSERT_MESSAGE(nanoseconds_ < 1e9, - "Timestamp nanoseconds out of range: %d", - nanoseconds_); + HARD_ASSERT(nanoseconds_ >= 0, "Timestamp nanoseconds out of range: %s", + nanoseconds_); + HARD_ASSERT(nanoseconds_ < 1e9, "Timestamp nanoseconds out of range: %s", + nanoseconds_); // Midnight at the beginning of 1/1/1 is the earliest timestamp Firestore // supports. - FIREBASE_ASSERT_MESSAGE(seconds_ >= -62135596800L, - "Timestamp seconds out of range: %lld", seconds_); + HARD_ASSERT(seconds_ >= -62135596800L, "Timestamp seconds out of range: %s", + seconds_); // This will break in the year 10,000. - FIREBASE_ASSERT_MESSAGE(seconds_ < 253402300800L, - "Timestamp seconds out of range: %lld", seconds_); + HARD_ASSERT(seconds_ < 253402300800L, "Timestamp seconds out of range: %s", + seconds_); } } // namespace firebase |