aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/time_with_zone.rb
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2014-06-05 16:23:47 +0930
committerMatthew Draper <matthew@trebex.net>2014-06-05 16:23:47 +0930
commitb2d070ddf6b79bf3ce0e8508c6872fc0d7e4b2e3 (patch)
treed6988c7cf09b9915644c42fb1adb8be7fc591d25 /activesupport/lib/active_support/time_with_zone.rb
parentb4c021ec1205b33f8cf7a50f87233ef3e40200f6 (diff)
parentc69baffdf752e2255fe1efc80ce32017bb1896e7 (diff)
downloadrails-b2d070ddf6b79bf3ce0e8508c6872fc0d7e4b2e3.tar.gz
rails-b2d070ddf6b79bf3ce0e8508c6872fc0d7e4b2e3.tar.bz2
rails-b2d070ddf6b79bf3ce0e8508c6872fc0d7e4b2e3.zip
Merge pull request #15421 from gchan/time_with_zone_precision
Fixed `ActiveSupport::TimeWithZone#-` so precision is not unnecessarily lost
Diffstat (limited to 'activesupport/lib/active_support/time_with_zone.rb')
-rw-r--r--activesupport/lib/active_support/time_with_zone.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb
index 3155c0ab0f..4a0ed356b1 100644
--- a/activesupport/lib/active_support/time_with_zone.rb
+++ b/activesupport/lib/active_support/time_with_zone.rb
@@ -262,7 +262,7 @@ module ActiveSupport
# If we're subtracting a Duration of variable length (i.e., years, months, days), move backwards from #time,
# otherwise move backwards #utc, for accuracy when moving across DST boundaries
if other.acts_like?(:time)
- utc.to_f - other.to_f
+ to_time - other.to_time
elsif duration_of_variable_length?(other)
method_missing(:-, other)
else