Source code

Revision control

Copy as Markdown

Other Tools

From: Michael Froman <mfroman@mozilla.com>
Date: Mon, 21 Jul 2025 17:36:00 -0500
Subject: Bug 1978462 - cherry-pick upstream abseil-cpp commit 66945910. r?ng!
Fixes errors:
ERROR - /builds/worker/checkouts/gecko/third_party/abseil-cpp/absl/time/time.h:1873:12: error: call to non-'constexpr' function 'int64_t absl::operator/(absl::Duration, absl::Duration)'
ERROR - /builds/worker/checkouts/gecko/third_party/abseil-cpp/absl/time/time.h:1884:12: error: call to non-'constexpr' function 'int64_t absl::operator/(absl::Duration, absl::Duration)'
ERROR - /builds/worker/checkouts/gecko/third_party/abseil-cpp/absl/time/time.h:1895:12: error: call to non-'constexpr' function 'int64_t absl::operator/(absl::Duration, absl::Duration)'
---
abseil-cpp/absl/time/time.h | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/abseil-cpp/absl/time/time.h b/abseil-cpp/absl/time/time.h
index db17a4cd40b..53bca90d156 100644
--- a/abseil-cpp/absl/time/time.h
+++ b/abseil-cpp/absl/time/time.h
@@ -1869,8 +1869,9 @@ ABSL_ATTRIBUTE_CONST_FUNCTION constexpr int64_t ToInt64Nanoseconds(Duration d) {
time_internal::GetRepHi(d) >> 33 == 0) {
return (time_internal::GetRepHi(d) * 1000 * 1000 * 1000) +
(time_internal::GetRepLo(d) / time_internal::kTicksPerNanosecond);
+ } else {
+ return d / Nanoseconds(1);
}
- return d / Nanoseconds(1);
}
ABSL_ATTRIBUTE_CONST_FUNCTION constexpr int64_t ToInt64Microseconds(
@@ -1880,8 +1881,9 @@ ABSL_ATTRIBUTE_CONST_FUNCTION constexpr int64_t ToInt64Microseconds(
return (time_internal::GetRepHi(d) * 1000 * 1000) +
(time_internal::GetRepLo(d) /
(time_internal::kTicksPerNanosecond * 1000));
+ } else {
+ return d / Microseconds(1);
}
- return d / Microseconds(1);
}
ABSL_ATTRIBUTE_CONST_FUNCTION constexpr int64_t ToInt64Milliseconds(
@@ -1891,8 +1893,9 @@ ABSL_ATTRIBUTE_CONST_FUNCTION constexpr int64_t ToInt64Milliseconds(
return (time_internal::GetRepHi(d) * 1000) +
(time_internal::GetRepLo(d) /
(time_internal::kTicksPerNanosecond * 1000 * 1000));
+ } else {
+ return d / Milliseconds(1);
}
- return d / Milliseconds(1);
}
ABSL_ATTRIBUTE_CONST_FUNCTION constexpr int64_t ToInt64Seconds(Duration d) {