From 53ca22f2e11cd3050d75385bc31b6bb5055a2738 Mon Sep 17 00:00:00 2001 From: Ari Pollak Date: Tue, 14 Aug 2012 16:33:06 -0400 Subject: Fix occasional microsecond conversion inaccuracy ActiveRecord::ConnectionAdapters::Column#microseconds did an unnecessary conversion to from Rational to float when calculating the integer number of microseconds. Some terminating decimal numbers in base10 are repeating decimal numbers in base2 (the format of float), and occasionally this causes a rounding error. Patch & explanation originally from Logan Bowers. --- activerecord/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'activerecord/CHANGELOG.md') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index faf1bbf232..d0c747d1f2 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,5 +1,11 @@ ## Rails 4.0.0 (unreleased) ## +* Fix Column.microseconds and Column.fast_string_to_date to avoid converting + timestamp seconds to a float, since it occasionally results in inaccuracies + with microsecond-precision times. Fixes #7352. + + *Ari Pollak* + * Raise `ArgumentError` if list of attributes to change is empty in `update_all`. *Roman Shatsov* -- cgit v1.2.3