summaryrefslogtreecommitdiff
path: root/absl/time/time.h
diff options
context:
space:
mode:
Diffstat (limited to 'absl/time/time.h')
-rw-r--r--absl/time/time.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/absl/time/time.h b/absl/time/time.h
index 33a4a630..152f3ff8 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);