aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorGeoff Buesing <gbuesing@gmail.com>2008-03-28 02:10:36 +0000
committerGeoff Buesing <gbuesing@gmail.com>2008-03-28 02:10:36 +0000
commit129d94477b1bb4478d1d8ceaed2a0f9a615e2d23 (patch)
treec057c9eded2ad6bdfc41a0ac05d02631135eadad /activesupport/lib/active_support
parente4645e00b7a427f32e470b4ad3fe494b698f725d (diff)
downloadrails-129d94477b1bb4478d1d8ceaed2a0f9a615e2d23.tar.gz
rails-129d94477b1bb4478d1d8ceaed2a0f9a615e2d23.tar.bz2
rails-129d94477b1bb4478d1d8ceaed2a0f9a615e2d23.zip
TimeWithZone time conversions don't need to be wrapped in TimeOrDateTime, because TZInfo does this internally
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9106 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/time_with_zone.rb14
1 files changed, 2 insertions, 12 deletions
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb
index 3c37ab2d4c..6566c1c385 100644
--- a/activesupport/lib/active_support/time_with_zone.rb
+++ b/activesupport/lib/active_support/time_with_zone.rb
@@ -12,12 +12,12 @@ module ActiveSupport
# Returns a Time or DateTime instance that represents the time in time_zone
def time
- @time ||= utc_to_local
+ @time ||= period.to_local(@utc)
end
# Returns a Time or DateTime instance that represents the time in UTC
def utc
- @utc ||= local_to_utc
+ @utc ||= period.to_utc(@time)
end
alias_method :comparable_time, :utc
alias_method :getgm, :utc
@@ -240,15 +240,5 @@ module ActiveSupport
def transfer_time_values_to_utc_constructor(time)
::Time.utc_time(time.year, time.month, time.day, time.hour, time.min, time.sec, time.respond_to?(:usec) ? time.usec : 0)
end
-
- # Replicating logic from TZInfo::Timezone#utc_to_local because we want to cache the period in an instance variable for reuse
- def utc_to_local
- ::TZInfo::TimeOrDateTime.wrap(utc) {|utc| period.to_local(utc)}
- end
-
- # Replicating logic from TZInfo::Timezone#local_to_utc because we want to cache the period in an instance variable for reuse
- def local_to_utc
- ::TZInfo::TimeOrDateTime.wrap(time) {|time| period.to_utc(time)}
- end
end
end