Permalink
Browse files

Don't cache the utc_offset we are already caching the timezone [#4301

…state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information...
1 parent 1412ad4 commit 7d0eea179b15c888d8e66654ea7922a9d70831e5 @spastorino spastorino committed with jeremy Mar 30, 2010
Showing with 5 additions and 2 deletions.
  1. +5 −2 activesupport/lib/active_support/values/time_zone.rb
@@ -198,10 +198,12 @@ def initialize(name, utc_offset, tzinfo = nil)
@name = name
@utc_offset = utc_offset
@tzinfo = tzinfo
+ @current_period = nil
end
def utc_offset
- @utc_offset ||= tzinfo.current_period.utc_offset
+ @current_period ||= tzinfo.current_period
+ @current_period.utc_offset
end
# Returns the offset of this time zone as a formatted string, of the
@@ -362,13 +364,14 @@ def tzinfo
"Wellington" ],
[ 46_800, "Nuku'alofa" ]].
each do |offset, *places|
- places.sort.each do |place|
+ places.each do |place|
place.freeze
zone = new(place, offset)
ZONES << zone
ZONES_MAP[place] = zone
end
end
+ ZONES.sort!
ZONES.freeze
ZONES_MAP.freeze

0 comments on commit 7d0eea1

Please sign in to comment.