aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/time
diff options
context:
space:
mode:
authorGeoff Buesing <gbuesing@gmail.com>2008-02-10 18:20:37 +0000
committerGeoff Buesing <gbuesing@gmail.com>2008-02-10 18:20:37 +0000
commit521714a39d2f74f6a7e617db68f8fafc93a425a0 (patch)
tree2eafd75da5bea0804aae3f5a7d9d8d7e3faeb01f /activesupport/lib/active_support/core_ext/time
parent94fa9fb74541b60ed04f2694558a6a98a9ce1cab (diff)
downloadrails-521714a39d2f74f6a7e617db68f8fafc93a425a0.tar.gz
rails-521714a39d2f74f6a7e617db68f8fafc93a425a0.tar.bz2
rails-521714a39d2f74f6a7e617db68f8fafc93a425a0.zip
Pruning unneeded Time#change_time_zone_to_current. Enhanced docs for #change_time_zone
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8848 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/core_ext/time')
-rw-r--r--activesupport/lib/active_support/core_ext/time/zones.rb13
1 files changed, 6 insertions, 7 deletions
diff --git a/activesupport/lib/active_support/core_ext/time/zones.rb b/activesupport/lib/active_support/core_ext/time/zones.rb
index 33c7800705..4705e93f27 100644
--- a/activesupport/lib/active_support/core_ext/time/zones.rb
+++ b/activesupport/lib/active_support/core_ext/time/zones.rb
@@ -42,7 +42,7 @@ module ActiveSupport #:nodoc:
end
end
- # Gives the corresponding time in the supplied zone. self is assumed to be in UTC regardless of constructor.
+ # Returns the simultaneous time in the supplied zone. self is assumed to be in UTC regardless of constructor.
#
# Examples:
#
@@ -58,19 +58,18 @@ module ActiveSupport #:nodoc:
::Time.zone ? in_time_zone(::Time.zone) : self
end
- # Replaces the existing zone; leaves time value intact. Examples:
+ # Replaces the existing zone; leaves time values intact. Examples:
#
# t = Time.utc(2000) # => Sat Jan 01 00:00:00 UTC 2000
# t.change_time_zone('Alaska') # => Sat, 01 Jan 2000 00:00:00 AKST -09:00
# t.change_time_zone('Hawaii') # => Sat, 01 Jan 2000 00:00:00 HST -10:00
+ #
+ # Note the difference between this method and #in_time_zone: #in_time_zone does a calculation to determine
+ # the simultaneous time in the supplied zone, whereas #change_time_zone does no calculation; it just
+ # "dials in" a new time zone for +self+
def change_time_zone(zone)
ActiveSupport::TimeWithZone.new(nil, get_zone(zone), self)
end
-
- # Replaces the existing zone to Time.zone; leaves time value intact
- def change_time_zone_to_current
- ::Time.zone ? change_time_zone(::Time.zone) : self
- end
private
def get_zone(time_zone)