diff options
author | Andreas Eger <dev@eger-andreas.de> | 2016-12-11 03:30:08 +0100 |
---|---|---|
committer | Andreas Eger <dev@eger-andreas.de> | 2017-05-13 21:38:15 +0200 |
commit | ad203bcb2be17e06909ab6d67ab2475673673bbc (patch) | |
tree | 337493888b00b12e03ca6050808cf62d51d2eda0 /ruby/lib | |
parent | 455b61c6b0f39ac269b26969877dd3c6f3e32270 (diff) | |
download | protobuf-ad203bcb2be17e06909ab6d67ab2475673673bbc.tar.gz protobuf-ad203bcb2be17e06909ab6d67ab2475673673bbc.tar.bz2 protobuf-ad203bcb2be17e06909ab6d67ab2475673673bbc.zip |
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.rb | 2 |
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 |