aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/date_time/conversions.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/core_ext/date_time/conversions.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/date_time/conversions.rb17
1 files changed, 1 insertions, 16 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 13d659f52a..262c03540b 100644
--- a/activesupport/lib/active_support/core_ext/date_time/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/date_time/conversions.rb
@@ -4,10 +4,6 @@ require 'active_support/core_ext/date_time/calculations'
require 'active_support/values/time_zone'
class DateTime
- # Ruby 1.9 has DateTime#to_time which internally relies on Time. We define our own #to_time which allows
- # DateTimes outside the range of what can be created with Time.
- remove_method :to_time
-
# Convert to a formatted string. See Time::DATE_FORMATS for predefined formats.
#
# This method is aliased to <tt>to_s</tt>.
@@ -57,16 +53,6 @@ class DateTime
alias_method :default_inspect, :inspect
alias_method :inspect, :readable_inspect
- # 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
- if offset == 0
- ::Time.utc_time(year, month, day, hour, min, sec, sec_fraction * 1000000)
- else
- self
- end
- end
-
# Returns DateTime with local offset for given year if format is local else offset is zero
#
# DateTime.civil_from_format :local, 2012
@@ -95,7 +81,6 @@ class DateTime
private
def seconds_since_unix_epoch
- seconds_per_day = 86_400
- (self - ::DateTime.civil(1970)) * seconds_per_day
+ strftime('%s')
end
end