aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext
diff options
context:
space:
mode:
authorPawel Pierzchala <pawel.pierzchala@llp.pl>2012-01-05 11:02:14 +0100
committerPawel Pierzchala <pawel.pierzchala@llp.pl>2012-01-05 13:23:13 +0100
commitc766f3e4b013cf4bcc4ad9ba64636bbf944b320c (patch)
treea3cf4069a0f6014b84cd8545446d61239d30c0e4 /activesupport/lib/active_support/core_ext
parent78372b6cbb655227f4e6ddcb32187704659de84f (diff)
downloadrails-c766f3e4b013cf4bcc4ad9ba64636bbf944b320c.tar.gz
rails-c766f3e4b013cf4bcc4ad9ba64636bbf944b320c.tar.bz2
rails-c766f3e4b013cf4bcc4ad9ba64636bbf944b320c.zip
Nano seconds fraction of time is copied properly in Time#advance
When day, month or year was passed, advance created a new time ignoring previous nsec fraction. Now nsec is passed through usec as a Rational number.
Diffstat (limited to 'activesupport/lib/active_support/core_ext')
-rw-r--r--activesupport/lib/active_support/core_ext/time/calculations.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb
index f3235d11bb..5e433f5dd9 100644
--- a/activesupport/lib/active_support/core_ext/time/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/time/calculations.rb
@@ -78,7 +78,7 @@ class Time
options[:hour] || hour,
options[:min] || (options[:hour] ? 0 : min),
options[:sec] || ((options[:hour] || options[:min]) ? 0 : sec),
- options[:usec] || ((options[:hour] || options[:min] || options[:sec]) ? 0 : usec)
+ options[:usec] || ((options[:hour] || options[:min] || options[:sec]) ? 0 : Rational(nsec, 1000))
)
end