summaryrefslogtreecommitdiff
path: root/absl/time
diff options
context:
space:
mode:
Diffstat (limited to 'absl/time')
-rw-r--r--absl/time/civil_time.h2
-rw-r--r--absl/time/duration.cc4
-rw-r--r--absl/time/time.h4
3 files changed, 6 insertions, 4 deletions
diff --git a/absl/time/civil_time.h b/absl/time/civil_time.h
index c8166d07..77c3be2e 100644
--- a/absl/time/civil_time.h
+++ b/absl/time/civil_time.h
@@ -519,7 +519,7 @@ namespace time_internal { // For functions found via ADL on civil-time tags.
//
// Example:
//
-// absl::CivilDay d = absl::CivilDay("1969-07-20");
+// absl::CivilDay d = absl::CivilDay(1969, 7, 20);
// std::cout << "Date is: " << d << "\n";
//
std::ostream& operator<<(std::ostream& os, CivilYear y);
diff --git a/absl/time/duration.cc b/absl/time/duration.cc
index 9a876811..f0b4631d 100644
--- a/absl/time/duration.cc
+++ b/absl/time/duration.cc
@@ -197,11 +197,11 @@ inline int64_t DecodeTwosComp(uint64_t v) { return absl::bit_cast<int64_t>(v); }
// double as overflow cases.
inline bool SafeAddRepHi(double a_hi, double b_hi, Duration* d) {
double c = a_hi + b_hi;
- if (c >= kint64max) {
+ if (c >= static_cast<double>(kint64max)) {
*d = InfiniteDuration();
return false;
}
- if (c <= kint64min) {
+ if (c <= static_cast<double>(kint64min)) {
*d = -InfiniteDuration();
return false;
}
diff --git a/absl/time/time.h b/absl/time/time.h
index 0b7312ee..46ac26b3 100644
--- a/absl/time/time.h
+++ b/absl/time/time.h
@@ -422,7 +422,9 @@ Duration Milliseconds(T n) {
template <typename T, time_internal::EnableIfFloat<T> = 0>
Duration Seconds(T n) {
if (n >= 0) { // Note: `NaN >= 0` is false.
- if (n >= (std::numeric_limits<int64_t>::max)()) return InfiniteDuration();
+ if (n >= static_cast<T>((std::numeric_limits<int64_t>::max)())) {
+ return InfiniteDuration();
+ }
return time_internal::MakePosDoubleDuration(n);
} else {
if (std::isnan(n))