aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorAndrew White <andrew.white@unboxedconsulting.com>2016-04-23 19:11:34 +0100
committerAndrew White <andrew.white@unboxedconsulting.com>2016-04-23 19:11:34 +0100
commit88d844b278163f19e910fc1acadf1dbb4afac527 (patch)
tree8d82572a80ad5058946c34729d88e331c35f2c71 /activesupport/lib
parentdbc7a7cb509ef0046afa327d4ac8330259fd8e73 (diff)
downloadrails-88d844b278163f19e910fc1acadf1dbb4afac527.tar.gz
rails-88d844b278163f19e910fc1acadf1dbb4afac527.tar.bz2
rails-88d844b278163f19e910fc1acadf1dbb4afac527.zip
Change Time#sec_fraction to use subsec
Time instances can have fractional parts smaller than a nanosecond.
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/time/calculations.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb
index 9c019e10b5..b755726db2 100644
--- a/activesupport/lib/active_support/core_ext/time/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/time/calculations.rb
@@ -75,9 +75,9 @@ class Time
# Returns the fraction of a second as a +Rational+
#
- # Time.new(2012, 8, 29, 0, 0, 0.5).sec_fraction # => (1/2)
+ # Time.new(2012, 8, 29, 0, 0, 0.5).sec_fraction # => (1/2)
def sec_fraction
- Rational(nsec, 1000000000)
+ subsec
end
# Returns a new Time where one or more of the elements have been changed according