aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/date_time
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2012-07-01 17:27:49 +0100
committerAndrew White <andyw@pixeltrix.co.uk>2012-07-01 17:27:49 +0100
commitd441de36971c0e5c0566def81f90a17dab3cc106 (patch)
tree440d7f7bdc6af3f0101a33f724b13dbae2e76548 /activesupport/lib/active_support/core_ext/date_time
parentaafa00f4c10a6791e6470112f0f1fbe5f2c3f649 (diff)
downloadrails-d441de36971c0e5c0566def81f90a17dab3cc106.tar.gz
rails-d441de36971c0e5c0566def81f90a17dab3cc106.tar.bz2
rails-d441de36971c0e5c0566def81f90a17dab3cc106.zip
Revert "Use strftime to convert DateTime to numeric"
There appears to be a bug with DateTime#strftime("%s") on 32-bit platforms. Bug report: http://bugs.ruby-lang.org/issues/6683 This reverts commit 210cd756a628cc19c0d6e44bee8c33dfb2d9d598.
Diffstat (limited to 'activesupport/lib/active_support/core_ext/date_time')
-rw-r--r--activesupport/lib/active_support/core_ext/date_time/conversions.rb3
1 files changed, 2 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 262c03540b..a4a6562c74 100644
--- a/activesupport/lib/active_support/core_ext/date_time/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/date_time/conversions.rb
@@ -81,6 +81,7 @@ class DateTime
private
def seconds_since_unix_epoch
- strftime('%s')
+ seconds_per_day = 86_400
+ (self - ::DateTime.civil(1970)) * seconds_per_day
end
end