diff options
author | Abseil Team <absl-team@google.com> | 2020-04-14T21·24-0700 |
---|---|---|
committer | Mark Barolak <mbar@google.com> | 2020-04-15T17·29-0400 |
commit | 71079e42cb4ae53db02f9bbe446ad51ed62fd17f (patch) | |
tree | 4602446a7d8bbf0e528433523fe7736b9f102909 /absl/time/time.h | |
parent | 2946ac0dea49c894215a998aebb19d2f1d942909 (diff) |
Export of internal Abseil changes
-- 2182f6d50e2bcb77858aaab6001ebffdc13bee89 by Derek Mauro <dmauro@google.com>: Use base_internal::AtomicHook instead of std::atomic for StatusPayloadPrinter Imports #661 PiperOrigin-RevId: 306514102 -- 6f8047057f4530c17c06ab1737a1937c86402807 by Mark Barolak <mbar@google.com>: Fix ABSL_RANDOM_RANDEN_COPTS setting on FreeBSD Import of https://github.com/abseil/abseil-cpp/pull/664 PiperOrigin-RevId: 306485774 -- cb3b73b9607d0009bbcfd7766f4f1fa4fde9c8b9 by Abseil Team <absl-team@google.com>: Avoid a -Wimplicit-int-float-conversion warning. Without this explicit cast, this code produces a warning of "implicit conversion from 'const int64_t' (aka 'const long') to 'double' may lose precision" when this warning is turned on. PiperOrigin-RevId: 306358838 -- ef895ea6b28c96b64531c218705bac9c3fa169d5 by Greg Falcon <gfalcon@google.com>: Internal change PiperOrigin-RevId: 306040909 GitOrigin-RevId: 2182f6d50e2bcb77858aaab6001ebffdc13bee89 Change-Id: I69555c1722745a74c1603c62a621ca765d253fe5
Diffstat (limited to 'absl/time/time.h')
-rw-r--r-- | absl/time/time.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/absl/time/time.h b/absl/time/time.h index 33a4a630c296..152f3ff865ed 100644 --- a/absl/time/time.h +++ b/absl/time/time.h @@ -1348,8 +1348,8 @@ constexpr Duration MakeDuration(int64_t hi, int64_t lo) { // it's positive and can be converted to int64_t without risk of UB. inline Duration MakePosDoubleDuration(double n) { const int64_t int_secs = static_cast<int64_t>(n); - const uint32_t ticks = - static_cast<uint32_t>((n - int_secs) * kTicksPerSecond + 0.5); + const uint32_t ticks = static_cast<uint32_t>( + (n - static_cast<double>(int_secs)) * kTicksPerSecond + 0.5); return ticks < kTicksPerSecond ? MakeDuration(int_secs, ticks) : MakeDuration(int_secs + 1, ticks - kTicksPerSecond); |