Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(747)

Unified Diff: net/quic/core/quic_time.h

Issue 2309603002: Round results of multiplying QuicBandwidth and QuicTime::Delta rather than truncating. No behavior… (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/core/quic_bandwidth_test.cc ('k') | net/quic/core/quic_time_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/quic_time.h
diff --git a/net/quic/core/quic_time.h b/net/quic/core/quic_time.h
index 9e1e238bfe31b3130975f4a4161b8bd94b006d9b..92e31bcc54bc963249172809c1fa6f5b404bdee5 100644
--- a/net/quic/core/quic_time.h
+++ b/net/quic/core/quic_time.h
@@ -13,6 +13,7 @@
#include <stdint.h>
+#include <cmath>
#include <ostream>
#include "base/compiler_specific.h"
@@ -247,7 +248,8 @@ inline QuicTime::Delta operator*(QuicTime::Delta lhs, int rhs) {
return QuicTime::Delta(lhs.time_offset_ * rhs);
}
inline QuicTime::Delta operator*(QuicTime::Delta lhs, double rhs) {
- return QuicTime::Delta(lhs.time_offset_ * rhs);
+ return QuicTime::Delta(
+ static_cast<int64_t>(std::llround(lhs.time_offset_ * rhs)));
}
inline QuicTime::Delta operator*(int lhs, QuicTime::Delta rhs) {
return rhs * lhs;
« no previous file with comments | « net/quic/core/quic_bandwidth_test.cc ('k') | net/quic/core/quic_time_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698