diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-08-17 10:19:33 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-08-17 14:47:40 -0300 |
commit | d6dbd7fbbcb38c7d34a0928bde2bfc7ce21618f0 (patch) | |
tree | 4b92d7f77dfe6307dc95552a8a806edbb5f47ada /activerecord/lib | |
parent | 25f65498c13e9a094eeaae1bd9e9dd19b6adfad4 (diff) | |
download | rails-d6dbd7fbbcb38c7d34a0928bde2bfc7ce21618f0.tar.gz rails-d6dbd7fbbcb38c7d34a0928bde2bfc7ce21618f0.tar.bz2 rails-d6dbd7fbbcb38c7d34a0928bde2bfc7ce21618f0.zip |
Merge pull request #7352 from aripollak/microsecond-timestamp
Fix occasional microsecond conversion inaccuracy
Conflicts:
activerecord/CHANGELOG.md
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/column.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/column.rb b/activerecord/lib/active_record/connection_adapters/column.rb index 88fe9c396e..3c5249bca8 100644 --- a/activerecord/lib/active_record/connection_adapters/column.rb +++ b/activerecord/lib/active_record/connection_adapters/column.rb @@ -180,7 +180,7 @@ module ActiveRecord # '0.123456' -> 123456 # '1.123456' -> 123456 def microseconds(time) - ((time[:sec_fraction].to_f % 1) * 1_000_000).to_i + time[:sec_fraction] ? (time[:sec_fraction] * 1_000_000).to_i : 0 end def new_date(year, mon, mday) @@ -205,7 +205,7 @@ module ActiveRecord # Doesn't handle time zones. def fast_string_to_time(string) if string =~ Format::ISO_DATETIME - microsec = ($7.to_f * 1_000_000).to_i + microsec = ($7.to_r * 1_000_000).to_i new_time $1.to_i, $2.to_i, $3.to_i, $4.to_i, $5.to_i, $6.to_i, microsec end end |