aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorJohn Firebaugh <john_firebaugh@us.ibm.com>2011-01-06 13:26:31 -0800
committerSantiago Pastorino <santiago@wyeworks.com>2011-02-03 13:11:56 -0200
commitbf0395837fc735bf98daed23f475b267e48c1118 (patch)
tree7c4ba5388501c0f5257e66799ce4d118daea92cd /activesupport/lib
parentc1c6f29214d3c280f5d1d4abb49d0b90424fcbd7 (diff)
downloadrails-bf0395837fc735bf98daed23f475b267e48c1118.tar.gz
rails-bf0395837fc735bf98daed23f475b267e48c1118.tar.bz2
rails-bf0395837fc735bf98daed23f475b267e48c1118.zip
Preserve fractional seconds in DateTime#to_time
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/date_time/conversions.rb2
1 files changed, 1 insertions, 1 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 029b8c41b4..21b84b994b 100644
--- a/activesupport/lib/active_support/core_ext/date_time/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/date_time/conversions.rb
@@ -66,7 +66,7 @@ class DateTime
# Attempts to convert self to a Ruby Time object; returns self if out of range of Ruby Time class
# If self has an offset other than 0, self will just be returned unaltered, since there's no clean way to map it to a Time
def to_time
- self.offset == 0 ? ::Time.utc_time(year, month, day, hour, min, sec) : self
+ self.offset == 0 ? ::Time.utc_time(year, month, day, hour, min, sec, sec_fraction * (RUBY_VERSION < '1.9' ? 86400000000 : 1000000)) : self
end
# To be able to keep Times, Dates and DateTimes interchangeable on conversions