diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-12-10 10:05:43 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-12-10 10:05:43 +0000 |
commit | bcbcc0260b4f75e9da7f009dfc7e3e0233158274 (patch) | |
tree | 28056969a6eacb34711e78dc20db4d1d54c4810b /activesupport/lib | |
parent | d0b5f640f2f4ad4f6c42d33300129601210257de (diff) | |
download | rails-bcbcc0260b4f75e9da7f009dfc7e3e0233158274.tar.gz rails-bcbcc0260b4f75e9da7f009dfc7e3e0233158274.tar.bz2 rails-bcbcc0260b4f75e9da7f009dfc7e3e0233158274.zip |
Ruby 1.9 compat: TimeZone avoids localtime conversion. References #1689 [Chu Yeow]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8369 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/values/time_zone.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb index 71e8528ae1..cd4b84bdc7 100644 --- a/activesupport/lib/active_support/values/time_zone.rb +++ b/activesupport/lib/active_support/values/time_zone.rb @@ -45,7 +45,7 @@ class TimeZone # Adjust the given time to the time zone represented by +self+. def adjust(time) - time = time.to_time + time = time.to_time unless time.is_a?(::Time) time + utc_offset - time.utc_offset end @@ -53,8 +53,9 @@ class TimeZone # zone, and then adjusts it to return the corresponding time in the # local time zone. def unadjust(time) - time = Time.local(*time.to_time.to_a) - time - utc_offset + time.utc_offset + time = time.to_time unless time.is_a?(::Time) + time = time.localtime + time - utc_offset - time.utc_offset end # Compare this time zone to the parameter. The two are comapred first on |