diff options
author | John Paul Ashenfelter <johnpaul@transitionpoint.com> | 2014-07-01 09:43:46 -0400 |
---|---|---|
committer | Godfrey Chan <godfreykfc@gmail.com> | 2014-07-02 15:01:35 -0700 |
commit | d75992b0b22b656d16a28c04eac771a93486f465 (patch) | |
tree | 94f8360a188fe2b6aae286d0962913efb3f3ddc8 /activesupport/lib/active_support | |
parent | a4104278b5cc5a7e7b15473c1ea74125f915f2db (diff) | |
download | rails-d75992b0b22b656d16a28c04eac771a93486f465.tar.gz rails-d75992b0b22b656d16a28c04eac771a93486f465.tar.bz2 rails-d75992b0b22b656d16a28c04eac771a93486f465.zip |
`DateTime#to_f` now preserves fractional seconds.
Previously this method always returns `.0` in the fractional part. This commit
changes it to preserve the fractional seconds instead.
Fixes #15994.
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/core_ext/date_time/conversions.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/date_time/conversions.rb b/activesupport/lib/active_support/core_ext/date_time/conversions.rb index 6ddfb72a0d..2a9c09fc29 100644 --- a/activesupport/lib/active_support/core_ext/date_time/conversions.rb +++ b/activesupport/lib/active_support/core_ext/date_time/conversions.rb @@ -71,9 +71,9 @@ class DateTime civil(year, month, day, hour, min, sec, offset) end - # Converts +self+ to a floating-point number of seconds since the Unix epoch. + # Converts +self+ to a floating-point number of seconds, including fractional microseconds, since the Unix epoch. def to_f - seconds_since_unix_epoch.to_f + seconds_since_unix_epoch.to_f + sec_fraction end # Converts +self+ to an integer number of seconds since the Unix epoch. |