aboutsummaryrefslogtreecommitdiffhomepage
path: root/ruby/lib
diff options
context:
space:
mode:
authorGravatar Andreas Eger <dev@eger-andreas.de>2016-12-11 03:30:08 +0100
committerGravatar Andreas Eger <dev@eger-andreas.de>2017-05-13 21:38:15 +0200
commitad203bcb2be17e06909ab6d67ab2475673673bbc (patch)
tree337493888b00b12e03ca6050808cf62d51d2eda0 /ruby/lib
parent455b61c6b0f39ac269b26969877dd3c6f3e32270 (diff)
fix floating point accuracy problem in Timestamp#to_f
`.quo` return the most exact devision which fixes accuracy problems for the timestamp coercion
Diffstat (limited to 'ruby/lib')
-rw-r--r--ruby/lib/google/protobuf/well_known_types.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/ruby/lib/google/protobuf/well_known_types.rb b/ruby/lib/google/protobuf/well_known_types.rb
index 547de874..921ddbc0 100644
--- a/ruby/lib/google/protobuf/well_known_types.rb
+++ b/ruby/lib/google/protobuf/well_known_types.rb
@@ -80,7 +80,7 @@ module Google
end
def to_f
- self.seconds + (self.nanos.to_f / 1_000_000_000)
+ self.seconds + (self.nanos.quo(1_000_000_000))
end
end