diff options
author | Andrew White <andrew.white@unboxedconsulting.com> | 2016-04-23 19:11:34 +0100 |
---|---|---|
committer | Andrew White <andrew.white@unboxedconsulting.com> | 2016-04-23 19:11:34 +0100 |
commit | 88d844b278163f19e910fc1acadf1dbb4afac527 (patch) | |
tree | 8d82572a80ad5058946c34729d88e331c35f2c71 /activesupport/lib/active_support | |
parent | dbc7a7cb509ef0046afa327d4ac8330259fd8e73 (diff) | |
download | rails-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/active_support')
-rw-r--r-- | activesupport/lib/active_support/core_ext/time/calculations.rb | 4 |
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 |