Hello community,

here is the log from the commit of package rubygem-tzinfo for openSUSE:Factory 
checked in at 2018-02-16 21:43:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-tzinfo (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-tzinfo.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-tzinfo"

Fri Feb 16 21:43:43 2018 rev:20 rq:577000 version:1.2.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-tzinfo/rubygem-tzinfo.changes    
2017-11-03 16:30:20.968201475 +0100
+++ /work/SRC/openSUSE:Factory/.rubygem-tzinfo.new/rubygem-tzinfo.changes       
2018-02-16 21:43:42.837161475 +0100
@@ -1,0 +2,11 @@
+Thu Feb 15 11:18:58 UTC 2018 - bgeu...@suse.com
+
+- Update to version 1.2.5
+
+  * Support recursively (deep) freezing Country and Timezone instances. #80.
+  * Allow negative daylight savings time offsets to be derived when reading
+    from zoneinfo files. The utc_offset and std_offset are now derived
+    correctly for Europe/Dublin in the 2018a and 2018b releases of the Time
+    Zone Database. 
+
+-------------------------------------------------------------------

Old:
----
  tzinfo-1.2.4.gem

New:
----
  tzinfo-1.2.5.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-tzinfo.spec ++++++
--- /var/tmp/diff_new_pack.WvbkDH/_old  2018-02-16 21:43:43.417140557 +0100
+++ /var/tmp/diff_new_pack.WvbkDH/_new  2018-02-16 21:43:43.421140414 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package rubygem-tzinfo
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,7 @@
 #
 
 Name:           rubygem-tzinfo
-Version:        1.2.4
+Version:        1.2.5
 Release:        0
 %define mod_name tzinfo
 %define mod_full_name %{mod_name}-%{version}

++++++ tzinfo-1.2.4.gem -> tzinfo-1.2.5.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/CHANGES.md new/CHANGES.md
--- old/CHANGES.md      2017-10-26 23:42:30.000000000 +0200
+++ new/CHANGES.md      2018-02-04 20:53:59.000000000 +0100
@@ -1,3 +1,12 @@
+Version 1.2.5 - 4-Feb-2018
+--------------------------
+
+* Support recursively (deep) freezing Country and Timezone instances. #80.
+* Allow negative daylight savings time offsets to be derived when reading from
+  zoneinfo files. The utc_offset and std_offset are now derived correctly for
+  Europe/Dublin in the 2018a and 2018b releases of the Time Zone Database.
+
+
 Version 1.2.4 - 26-Oct-2017
 ---------------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/LICENSE new/LICENSE
--- old/LICENSE 2017-10-26 23:42:30.000000000 +0200
+++ new/LICENSE 2018-02-04 20:53:59.000000000 +0100
@@ -1,4 +1,4 @@
-Copyright (c) 2005-2017 Philip Ross
+Copyright (c) 2005-2018 Philip Ross
 
 Permission is hereby granted, free of charge, to any person obtaining a copy 
of 
 this software and associated documentation files (the "Software"), to deal in 
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
Binary files old/checksums.yaml.gz.sig and new/checksums.yaml.gz.sig differ
Binary files old/data.tar.gz.sig and new/data.tar.gz.sig differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/tzinfo/country_timezone.rb 
new/lib/tzinfo/country_timezone.rb
--- old/lib/tzinfo/country_timezone.rb  2017-10-26 23:42:30.000000000 +0200
+++ new/lib/tzinfo/country_timezone.rb  2018-02-04 20:53:59.000000000 +0100
@@ -79,7 +79,13 @@
       # calculated multiple times in concurrently executing threads. It is not 
       # worth the overhead of locking to ensure that @latitude is only 
       # calculated once.
-      @latitude ||= RubyCoreSupport.rational_new!(@latitude_numerator, 
@latitude_denominator)
+      unless @latitude
+         result = RubyCoreSupport.rational_new!(@latitude_numerator, 
@latitude_denominator)
+         return result if frozen?
+         @latitude = result
+      end
+
+      @latitude
     end
     
     # The longitude of this timezone in degrees as a Rational.
@@ -88,7 +94,13 @@
       # calculated multiple times in concurrently executing threads. It is not 
       # worth the overhead of locking to ensure that @longitude is only 
       # calculated once.
-      @longitude ||= RubyCoreSupport.rational_new!(@longitude_numerator, 
@longitude_denominator)
+      unless @longitude
+        result = RubyCoreSupport.rational_new!(@longitude_numerator, 
@longitude_denominator)
+        return result if frozen?
+        @longitude = result
+      end
+
+      @longitude
     end
     
     # Returns true if and only if the given CountryTimezone is equal to the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/tzinfo/ruby_country_info.rb 
new/lib/tzinfo/ruby_country_info.rb
--- old/lib/tzinfo/ruby_country_info.rb 2017-10-26 23:42:30.000000000 +0200
+++ new/lib/tzinfo/ruby_country_info.rb 2018-02-04 20:53:59.000000000 +0100
@@ -22,7 +22,9 @@
       # calculated once.
     
       unless @zone_identifiers
-        @zone_identifiers = zones.collect {|zone| zone.identifier}.freeze
+        result = zones.collect {|zone| zone.identifier}.freeze
+        return result if frozen?
+        @zone_identifiers = result
       end
       
       @zone_identifiers
@@ -40,8 +42,10 @@
       unless @zones
         zones = Zones.new
         @block.call(zones) if @block
+        result = zones.list.freeze
+        return result if frozen?
         @block = nil
-        @zones = zones.list.freeze
+        @zones = result
       end
       
       @zones
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/tzinfo/time_or_datetime.rb 
new/lib/tzinfo/time_or_datetime.rb
--- old/lib/tzinfo/time_or_datetime.rb  2017-10-26 23:42:30.000000000 +0200
+++ new/lib/tzinfo/time_or_datetime.rb  2018-02-04 20:53:59.000000000 +0100
@@ -54,11 +54,14 @@
       # calculated once.
     
       unless @time
-        if @timestamp
-          @time = Time.at(@timestamp).utc
+        result = if @timestamp
+          Time.at(@timestamp).utc
         else
-          @time = Time.utc(year, mon, mday, hour, min, sec, usec)
+          Time.utc(year, mon, mday, hour, min, sec, usec)
         end
+
+        return result if frozen?
+        @time = result
       end
       
       @time      
@@ -78,7 +81,9 @@
         # Avoid using Rational unless necessary.
         u = usec
         s = u == 0 ? sec : Rational(sec * 1000000 + u, 1000000)
-        @datetime = RubyCoreSupport.datetime_new(year, mon, mday, hour, min, s)
+        result = RubyCoreSupport.datetime_new(year, mon, mday, hour, min, s)
+        return result if frozen?
+        @datetime = result
       end
       
       @datetime
@@ -92,7 +97,9 @@
       # calculated once.
     
       unless @timestamp
-        @timestamp = to_time.to_i
+        result = to_time.to_i
+        return result if frozen?
+        @timestamp = result
       end
       
       @timestamp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/tzinfo/timezone_offset.rb 
new/lib/tzinfo/timezone_offset.rb
--- old/lib/tzinfo/timezone_offset.rb   2017-10-26 23:42:30.000000000 +0200
+++ new/lib/tzinfo/timezone_offset.rb   2018-02-04 20:53:59.000000000 +0100
@@ -1,11 +1,34 @@
 module TZInfo
   # Represents an offset defined in a Timezone data file.
   class TimezoneOffset
-    # The base offset of the timezone from UTC in seconds.
+    # The base offset of the timezone from UTC in seconds. This does not 
include
+    # any adjustment made for daylight savings time and will typically remain
+    # constant throughout the year.
+    #
+    # To obtain the currently observed offset from UTC, including the effect of
+    # daylight savings time, use utc_total_offset instead.
+    #
+    # Note that zoneinfo files only include the value of utc_total_offset and a
+    # DST flag. When using ZoneinfoDataSource, the utc_offset will be derived
+    # from changes to the UTC total offset and the DST flag. As a consequence,
+    # utc_total_offset will always be correct, but utc_offset may be 
inaccurate.
+    #
+    # If you require utc_offset to be accurate, install the tzinfo-data gem and
+    # set RubyDataSource as the DataSource.
     attr_reader :utc_offset
     
-    # The offset from standard time for the zone in seconds (i.e. non-zero if 
-    # daylight savings is being observed).
+    # The offset from the time zone's standard time in seconds. Zero
+    # when daylight savings time is not in effect. Non-zero (usually 3600 = 1
+    # hour) if daylight savings is being observed.
+    #
+    # Note that zoneinfo files only include the value of utc_total_offset and
+    # a DST flag. When using DataSources::ZoneinfoDataSource, the std_offset
+    # will be derived from changes to the UTC total offset and the DST flag. As
+    # a consequence, utc_total_offset will always be correct, but std_offset
+    # may be inaccurate.
+    #
+    # If you require std_offset to be accurate, install the tzinfo-data gem
+    # and set RubyDataSource as the DataSource.
     attr_reader :std_offset
     
     # The total offset of this observance from UTC in seconds 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/tzinfo/timezone_period.rb 
new/lib/tzinfo/timezone_period.rb
--- old/lib/tzinfo/timezone_period.rb   2017-10-26 23:42:30.000000000 +0200
+++ new/lib/tzinfo/timezone_period.rb   2018-02-04 20:53:59.000000000 +0100
@@ -38,14 +38,36 @@
       @utc_total_offset_rational = nil      
     end
             
-    # Base offset of the timezone from UTC (seconds).
+    # The base offset of the timezone from UTC in seconds. This does not 
include
+    # any adjustment made for daylight savings time and will typically remain
+    # constant throughout the year.
+    #
+    # To obtain the currently observed offset from UTC, including the effect of
+    # daylight savings time, use utc_total_offset instead.
+    #
+    # Note that zoneinfo files only include the value of utc_total_offset and a
+    # DST flag. When using ZoneinfoDataSource, the utc_offset will be derived
+    # from changes to the UTC total offset and the DST flag. As a consequence,
+    # utc_total_offset will always be correct, but utc_offset may be 
inaccurate.
+    #
+    # If you require utc_offset to be accurate, install the tzinfo-data gem and
+    # set RubyDataSource as the DataSource.
     def utc_offset
       @offset.utc_offset
     end
     
-    # Offset from the local time where daylight savings is in effect (seconds).
-    # E.g.: utc_offset could be -5 hours. Normally, std_offset would be 0. 
-    # During daylight savings, std_offset would typically become +1 hours.
+    # The offset from the time zone's standard time in seconds. Zero
+    # when daylight savings time is not in effect. Non-zero (usually 3600 = 1
+    # hour) if daylight savings is being observed.
+    #
+    # Note that zoneinfo files only include the value of utc_total_offset and
+    # a DST flag. When using DataSources::ZoneinfoDataSource, the std_offset
+    # will be derived from changes to the UTC total offset and the DST flag. As
+    # a consequence, utc_total_offset will always be correct, but std_offset
+    # may be inaccurate.
+    #
+    # If you require std_offset to be accurate, install the tzinfo-data gem
+    # and set RubyDataSource as the DataSource.
     def std_offset
       @offset.std_offset
     end
@@ -71,7 +93,9 @@
       # to ensure that @zone_identifiers is only calculated once.
     
       unless @utc_total_offset_rational
-        @utc_total_offset_rational = 
OffsetRationals.rational_for_offset(utc_total_offset) 
+        result = OffsetRationals.rational_for_offset(utc_total_offset)
+        return result if frozen?
+        @utc_total_offset_rational = result
       end
       @utc_total_offset_rational
     end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/tzinfo/timezone_proxy.rb 
new/lib/tzinfo/timezone_proxy.rb
--- old/lib/tzinfo/timezone_proxy.rb    2017-10-26 23:42:30.000000000 +0200
+++ new/lib/tzinfo/timezone_proxy.rb    2018-02-04 20:53:59.000000000 +0100
@@ -93,7 +93,13 @@
         # calculated multiple times in concurrently executing threads. It is 
not 
         # worth the overhead of locking to ensure that @real_timezone is only 
         # calculated once.
-        @real_timezone ||= Timezone.get(@identifier)
+        unless @real_timezone
+          result = Timezone.get(@identifier)
+          return result if frozen?
+          @real_timezone = result
+        end
+
+        @real_timezone
       end     
   end 
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/tzinfo/timezone_transition.rb 
new/lib/tzinfo/timezone_transition.rb
--- old/lib/tzinfo/timezone_transition.rb       2017-10-26 23:42:30.000000000 
+0200
+++ new/lib/tzinfo/timezone_transition.rb       2018-02-04 20:53:59.000000000 
+0100
@@ -43,7 +43,12 @@
       # worth the overhead of locking to ensure that @local_end_at is only
       # calculated once.
     
-      @local_end_at = at.add_with_convert(@previous_offset.utc_total_offset) 
unless @local_end_at
+      unless @local_end_at
+        result = at.add_with_convert(@previous_offset.utc_total_offset)
+        return result if frozen?
+        @local_end_at = result
+      end
+
       @local_end_at
     end
     
@@ -67,7 +72,12 @@
       # worth the overhead of locking to ensure that @local_start_at is only
       # calculated once.
     
-      @local_start_at = at.add_with_convert(@offset.utc_total_offset) unless 
@local_start_at
+      unless @local_start_at
+        result = at.add_with_convert(@offset.utc_total_offset)
+        return result if frozen?
+        @local_start_at = result
+      end
+
       @local_start_at
     end
     
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/tzinfo/timezone_transition_definition.rb 
new/lib/tzinfo/timezone_transition_definition.rb
--- old/lib/tzinfo/timezone_transition_definition.rb    2017-10-26 
23:42:30.000000000 +0200
+++ new/lib/tzinfo/timezone_transition_definition.rb    2018-02-04 
20:53:59.000000000 +0100
@@ -71,13 +71,16 @@
       # overhead of locking to ensure that @at is only calculated once.
       
       unless @at
-        unless @denominator 
-          @at = TimeOrDateTime.new(@numerator_or_time)
+        result = unless @denominator
+          TimeOrDateTime.new(@numerator_or_time)
         else
           r = RubyCoreSupport.rational_new!(@numerator_or_time, @denominator)
           dt = RubyCoreSupport.datetime_new!(r, 0, Date::ITALY)
-          @at = TimeOrDateTime.new(dt)
+          TimeOrDateTime.new(dt)
         end
+
+        return result if frozen?
+        @at = result
       end
       
       @at
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/tzinfo/zoneinfo_country_info.rb 
new/lib/tzinfo/zoneinfo_country_info.rb
--- old/lib/tzinfo/zoneinfo_country_info.rb     2017-10-26 23:42:30.000000000 
+0200
+++ new/lib/tzinfo/zoneinfo_country_info.rb     2018-02-04 20:53:59.000000000 
+0100
@@ -20,7 +20,9 @@
       # calculated once.
     
       unless @zone_identifiers
-        @zone_identifiers = zones.collect {|zone| zone.identifier}.freeze
+        result = zones.collect {|zone| zone.identifier}.freeze
+        return result if frozen?
+        @zone_identifiers = result
       end
       
       @zone_identifiers
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/tzinfo/zoneinfo_timezone_info.rb 
new/lib/tzinfo/zoneinfo_timezone_info.rb
--- old/lib/tzinfo/zoneinfo_timezone_info.rb    2017-10-26 23:42:30.000000000 
+0200
+++ new/lib/tzinfo/zoneinfo_timezone_info.rb    2018-02-04 20:53:59.000000000 
+0100
@@ -93,19 +93,21 @@
           if offset[:is_dst]
             utc_offset_from_next = transition[:utc_offset_from_next]
 
-            difference_to_previous = utc_total_offset - 
(utc_offset_from_previous || utc_total_offset)
-            difference_to_next = utc_total_offset - (utc_offset_from_next || 
utc_total_offset)
+            difference_to_previous = (utc_total_offset - 
(utc_offset_from_previous || utc_total_offset)).abs
+            difference_to_next = (utc_total_offset - (utc_offset_from_next || 
utc_total_offset)).abs
 
-            utc_offset = if difference_to_previous > 0 && difference_to_next > 0
+            utc_offset = if difference_to_previous == 3600
+              utc_offset_from_previous
+            elsif difference_to_next == 3600
+              utc_offset_from_next
+            elsif difference_to_previous > 0 && difference_to_next > 0
               difference_to_previous < difference_to_next ? 
utc_offset_from_previous : utc_offset_from_next
             elsif difference_to_previous > 0
               utc_offset_from_previous
             elsif difference_to_next > 0
               utc_offset_from_next
-            else # difference_to_previous <= 0 && difference_to_next <= 0
-              # DST, but the either the offset has stayed the same or decreased
-              # relative to both the previous and next used base utc offset, or
-              # there are no non-DST offsets. Assume a 1 hour offset from base.
+            else
+              # No difference, assume a 1 hour offset from standard time.
               utc_total_offset - 3600
             end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2017-10-26 23:42:30.000000000 +0200
+++ new/metadata        2018-02-04 20:53:59.000000000 +0100
@@ -1,7 +1,7 @@
 --- !ruby/object:Gem::Specification
 name: tzinfo
 version: !ruby/object:Gem::Version
-  version: 1.2.4
+  version: 1.2.5
 platform: ruby
 authors:
 - Philip Ross
@@ -30,7 +30,7 @@
   YbX/8MDD3wwHu+knVnVsGNVuu/leNr+hJGgTUGXgcsu6nqYc4QVD+Amj1rI8D6at
   IYlrSPqJ7q3pK9kchFKrrktRA6yVf+fR
   -----END CERTIFICATE-----
-date: 2017-10-26 00:00:00.000000000 Z
+date: 2018-02-04 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: thread_safe
@@ -186,7 +186,7 @@
       version: '0'
 requirements: []
 rubyforge_project: 
-rubygems_version: 2.6.14
+rubygems_version: 2.7.4
 signing_key: 
 specification_version: 4
 summary: Daylight savings aware timezone library
Binary files old/metadata.gz.sig and new/metadata.gz.sig differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/tc_country.rb new/test/tc_country.rb
--- old/test/tc_country.rb      2017-10-26 23:42:30.000000000 +0200
+++ new/test/tc_country.rb      2018-02-04 20:53:59.000000000 +0100
@@ -190,7 +190,6 @@
     # If country gets reloaded for some reason, it needs to force a reload of
     # the country index.
     
-    c = Country.get('US')
     assert_equal('US', Country.get('US').code)
 
     # Suppress redefined method warnings.
@@ -198,7 +197,6 @@
       load 'tzinfo/country.rb'
     end
     
-    c = Country.get('US')
     assert_equal('US', Country.get('US').code)
   end
   
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/tc_country_timezone.rb 
new/test/tc_country_timezone.rb
--- old/test/tc_country_timezone.rb     2017-10-26 23:42:30.000000000 +0200
+++ new/test/tc_country_timezone.rb     2018-02-04 20:53:59.000000000 +0100
@@ -17,6 +17,12 @@
     ct = CountryTimezone.new!('Europe/London', 2059, 40, -5, 16)
     assert_equal(Rational(2059, 40), ct.latitude)
   end
+
+  def test_latitude_after_freeze_new!
+    ct = CountryTimezone.new!('Europe/London', 2059, 40, -5, 16)
+    ct.freeze
+    assert_equal(Rational(2059, 40), ct.latitude)
+  end
   
   def test_latitude_new
     ct = CountryTimezone.new('Europe/London', Rational(2059, 40), Rational(-5, 
16))
@@ -27,6 +33,12 @@
     ct = CountryTimezone.new!('Europe/London', 2059, 40, -5, 16)
     assert_equal(Rational(-5, 16), ct.longitude)
   end
+
+  def test_longitude_after_freeze_new!
+    ct = CountryTimezone.new!('Europe/London', 2059, 40, -5, 16)
+    ct.freeze
+    assert_equal(Rational(-5, 16), ct.longitude)
+  end
   
   def test_longitude_new
     ct = CountryTimezone.new('Europe/London', Rational(2059, 40), Rational(-5, 
16))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/tc_ruby_country_info.rb 
new/test/tc_ruby_country_info.rb
--- old/test/tc_ruby_country_info.rb    2017-10-26 23:42:30.000000000 +0200
+++ new/test/tc_ruby_country_info.rb    2018-02-04 20:53:59.000000000 +0100
@@ -37,6 +37,19 @@
     assert_equal(['ZZ/TimezoneB', 'ZZ/TimezoneA', 'ZZ/TimezoneC', 
'ZZ/TimezoneD'], ci.zone_identifiers)
     assert(ci.zone_identifiers.frozen?)
   end
+
+  def test_zone_identifiers_after_freeze
+    ci = RubyCountryInfo.new('ZZ', 'Zzz') do |c|
+      c.timezone('ZZ/TimezoneB', 1, 2, 1, 2, 'Timezone B')
+      c.timezone('ZZ/TimezoneA', 1, 4, 1, 4, 'Timezone A')
+      c.timezone('ZZ/TimezoneC', -10, 3, -20, 7, 'C')
+      c.timezone('ZZ/TimezoneD', -10, 3, -20, 7)
+    end
+
+    ci.freeze
+
+    assert_equal(['ZZ/TimezoneB', 'ZZ/TimezoneA', 'ZZ/TimezoneC', 
'ZZ/TimezoneD'], ci.zone_identifiers)
+  end
   
   def test_zones_empty
     ci = RubyCountryInfo.new('ZZ', 'Zzz') {|c| }
@@ -65,6 +78,23 @@
       ci.zones)
     assert(ci.zones.frozen?)
   end
+
+  def test_zones_after_freeze
+    ci = RubyCountryInfo.new('ZZ', 'Zzz') do |c|
+      c.timezone('ZZ/TimezoneB', 1, 2, 1, 2, 'Timezone B')
+      c.timezone('ZZ/TimezoneA', 1, 4, 1, 4, 'Timezone A')
+      c.timezone('ZZ/TimezoneC', -10, 3, -20, 7, 'C')
+      c.timezone('ZZ/TimezoneD', -10, 3, -20, 7)
+    end
+
+    ci.freeze
+
+    assert_equal([CountryTimezone.new!('ZZ/TimezoneB', 1, 2, 1, 2, 'Timezone 
B'),
+      CountryTimezone.new!('ZZ/TimezoneA', 1, 4, 1, 4, 'Timezone A'),
+      CountryTimezone.new!('ZZ/TimezoneC', -10, 3, -20, 7, 'C'),
+      CountryTimezone.new!('ZZ/TimezoneD', -10, 3, -20, 7)],
+      ci.zones)
+  end
   
   def test_deferred_evaluate
     block_called = false
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/tc_time_or_datetime.rb 
new/test/tc_time_or_datetime.rb
--- old/test/tc_time_or_datetime.rb     2017-10-26 23:42:30.000000000 +0200
+++ new/test/tc_time_or_datetime.rb     2018-02-04 20:53:59.000000000 +0100
@@ -128,6 +128,11 @@
     assert_equal(Time.utc(2006, 3, 24, 15, 32, 3, 721123),
       TimeOrDateTime.new(DateTime.new(2006, 3, 24, 15, 32, 3 + 
Rational(7211239, 10000000))).to_time)
   end
+
+  def test_to_time_after_freeze
+    assert_equal(Time.utc(2006, 3, 24, 15, 32, 3), 
TimeOrDateTime.new(DateTime.new(2006, 3, 24, 15, 32, 3)).freeze.to_time)
+    assert_equal(Time.utc(2006, 3, 24, 15, 32, 3), 
TimeOrDateTime.new(1143214323).freeze.to_time)
+  end
   
   def test_to_datetime
     assert_equal(DateTime.new(2006, 3, 24, 15, 32, 3),
@@ -157,6 +162,11 @@
     assert_equal(DateTime.new(2006, 3, 24, 15, 32, 3 + Rational(721123, 
1000000)),
       TimeOrDateTime.new(Time.utc(2006, 3, 24, 15, 32, 3, 721123 + Rational(9, 
10))).to_datetime)
   end
+
+  def test_to_datetime_after_freeze
+    assert_equal(DateTime.new(2006, 3, 24, 15, 32, 3), 
TimeOrDateTime.new(Time.utc(2006, 3, 24, 15, 32, 3)).freeze.to_datetime)
+    assert_equal(DateTime.new(2006, 3, 24, 15, 32, 3), 
TimeOrDateTime.new(1143214323).freeze.to_datetime)
+  end
   
   def test_to_i
     assert_equal(1143214323,
@@ -172,6 +182,11 @@
     assert_equal(1143214323,
       TimeOrDateTime.new('1143214323').to_i)
   end
+
+  def test_to_i_after_freeze
+    assert_equal(1143214323, TimeOrDateTime.new(Time.utc(2006, 3, 24, 15, 32, 
3)).freeze.to_i)
+    assert_equal(1143214323, TimeOrDateTime.new(DateTime.new(2006, 3, 24, 15, 
32, 3)).freeze.to_i)
+  end
   
   def test_to_orig
     assert_equal(Time.utc(2006, 3, 24, 15, 32, 3),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/tc_timezone_period.rb 
new/test/tc_timezone_period.rb
--- old/test/tc_timezone_period.rb      2017-10-26 23:42:30.000000000 +0200
+++ new/test/tc_timezone_period.rb      2018-02-04 20:53:59.000000000 +0100
@@ -149,6 +149,13 @@
     assert_nil(p.local_end)
     assert_nil(p.local_end_time)
   end
+
+  def test_utc_total_offset_rational_after_freeze
+    o = TimezoneOffset.new(3600, 0, :TEST)
+    p = TimezonePeriod.new(nil, nil, o)
+    p.freeze
+    assert_equal(Rational(1, 24), p.utc_total_offset_rational)
+  end
   
   def test_dst    
     p1 = TimezonePeriod.new(nil, nil, TimezoneOffset.new(-14400, 3600, :TEST))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/tc_timezone_proxy.rb 
new/test/tc_timezone_proxy.rb
--- old/test/tc_timezone_proxy.rb       2017-10-26 23:42:30.000000000 +0200
+++ new/test/tc_timezone_proxy.rb       2018-02-04 20:53:59.000000000 +0100
@@ -88,6 +88,15 @@
       assert_same(Timezone.get('UTC'), proxy.canonical_zone)
     end
   end
+
+  def test_after_freeze
+    proxy = TimezoneProxy.new('Europe/London')
+    real = Timezone.get('Europe/London')
+    t = Time.utc(2017, 6, 1)
+    proxy.freeze
+    assert_equal('Europe/London', proxy.identifier)
+    assert_equal(real.utc_to_local(t), proxy.utc_to_local(t))
+  end
   
   def test_equals
     assert_equal(true, TimezoneProxy.new('Europe/London') == 
TimezoneProxy.new('Europe/London'))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/tc_timezone_transition.rb 
new/test/tc_timezone_transition.rb
--- old/test/tc_timezone_transition.rb  2017-10-26 23:42:30.000000000 +0200
+++ new/test/tc_timezone_transition.rb  2018-02-04 20:53:59.000000000 +0100
@@ -68,6 +68,13 @@
     assert(TimeOrDateTime.new(DateTime.new(2006, 5, 30, 1, 31, 
20)).eql?(t2.local_end_at))
     assert(TimeOrDateTime.new(Time.utc(2006, 5, 30, 1, 31, 
20)).eql?(t3.local_end_at))
   end
+
+  def test_local_end_at_after_freeze
+    t = TestTimezoneTransition.new(TimezoneOffset.new(3600, 3600, :TDT),
+      TimezoneOffset.new(3600, 0, :TST), 1148949080)
+    t.freeze
+    assert(TimeOrDateTime.new(1148952680).eql?(t.local_end_at))
+  end
   
   def test_local_end
     t1 = TestTimezoneTransition.new(TimezoneOffset.new(3600, 3600, :TDT),
@@ -107,6 +114,13 @@
     assert(TimeOrDateTime.new(DateTime.new(2006, 5, 30, 2, 31, 
20)).eql?(t2.local_start_at))
     assert(TimeOrDateTime.new(Time.utc(2006, 5, 30, 2, 31, 
20)).eql?(t3.local_start_at))
   end
+
+  def test_local_start_at_after_freeze
+    t = TestTimezoneTransition.new(TimezoneOffset.new(3600, 3600, :TDT),
+      TimezoneOffset.new(3600, 0, :TST), 1148949080)
+    t.freeze
+    assert(TimeOrDateTime.new(1148956280).eql?(t.local_start_at))
+  end
   
   def test_local_start
     t1 = TestTimezoneTransition.new(TimezoneOffset.new(3600, 3600, :TDT),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/tc_timezone_transition_definition.rb 
new/test/tc_timezone_transition_definition.rb
--- old/test/tc_timezone_transition_definition.rb       2017-10-26 
23:42:30.000000000 +0200
+++ new/test/tc_timezone_transition_definition.rb       2018-02-04 
20:53:59.000000000 +0100
@@ -70,6 +70,17 @@
       assert(TimeOrDateTime.new(DateTime.new(2038, 1, 19, 3, 14, 
8)).eql?(t.at))
     end
   end
+
+  def test_at_after_freeze
+    t1 = TimezoneTransitionDefinition.new(TimezoneOffset.new(3600, 3600, :TDT),
+      TimezoneOffset.new(3600, 0, :TST), 1148949080)
+    t2 = TimezoneTransitionDefinition.new(TimezoneOffset.new(3600, 3600, :TDT),
+      TimezoneOffset.new(3600, 0, :TST), 5300392727, 2160)
+    t1.freeze
+    t2.freeze
+    assert(TimeOrDateTime.new(1148949080).eql?(t1.at))
+    assert(TimeOrDateTime.new(DateTime.new(2006, 5, 30, 0, 31, 
20)).eql?(t2.at))
+  end
   
   def test_eql_timestamp
     t1 = TimezoneTransitionDefinition.new(TimezoneOffset.new(3600, 3600, :TDT),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/tc_zoneinfo_country_info.rb 
new/test/tc_zoneinfo_country_info.rb
--- old/test/tc_zoneinfo_country_info.rb        2017-10-26 23:42:30.000000000 
+0200
+++ new/test/tc_zoneinfo_country_info.rb        2018-02-04 20:53:59.000000000 
+0100
@@ -35,6 +35,20 @@
     assert(!ci.zones.equal?(zones))
     assert(!zones.frozen?)
   end
+
+  def test_zone_identifiers_after_freeze
+    zones = [
+      CountryTimezone.new('ZZ/TimezoneB', Rational(1, 2), Rational(1, 2), 
'Timezone B'),
+      CountryTimezone.new('ZZ/TimezoneA', Rational(1, 4), Rational(1, 4), 
'Timezone A'),
+      CountryTimezone.new('ZZ/TimezoneC', Rational(-10, 3), Rational(-20, 7), 
'C'),
+      CountryTimezone.new('ZZ/TimezoneD', Rational(-10, 3), Rational(-20, 7))
+    ]
+
+    ci = ZoneinfoCountryInfo.new('ZZ', 'Zzz', zones)
+    ci.freeze
+
+    assert_equal(['ZZ/TimezoneB', 'ZZ/TimezoneA', 'ZZ/TimezoneC', 
'ZZ/TimezoneD'], ci.zone_identifiers)
+  end
   
   def test_zones_empty
     ci = ZoneinfoCountryInfo.new('ZZ', 'Zzz', [])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/tc_zoneinfo_timezone_info.rb 
new/test/tc_zoneinfo_timezone_info.rb
--- old/test/tc_zoneinfo_timezone_info.rb       2017-10-26 23:42:30.000000000 
+0200
+++ new/test/tc_zoneinfo_timezone_info.rb       2018-02-04 20:53:59.000000000 
+0100
@@ -1070,6 +1070,110 @@
       assert_period(:XST1, 3600,    0, false, Time.utc(2000,  4, 1),           
        nil, info)
     end
   end
+
+  def test_read_offset_negative_std_offset_dst
+    # The zoneinfo files don't include the offset from standard time, so this
+    # has to be derived by looking at changes in the total UTC offset.
+
+    offsets = [
+      {:gmtoff => -100, :isdst => false, :abbrev => 'LMT'},
+      {:gmtoff => 3600, :isdst => false, :abbrev => 'XST'},
+      {:gmtoff =>    0, :isdst => true,  :abbrev => 'XWT'}]
+
+    transitions = [
+      {:at => Time.utc(2000,  1, 1), :offset_index => 1},
+      {:at => Time.utc(2000,  2, 1), :offset_index => 2},
+      {:at => Time.utc(2000,  3, 1), :offset_index => 1},
+      {:at => Time.utc(2000,  4, 1), :offset_index => 2},
+      {:at => Time.utc(2000,  5, 1), :offset_index => 1}]
+
+    tzif_test(offsets, transitions) do |path, format|
+      info = ZoneinfoTimezoneInfo.new('Zone/NegativeStdOffsetDst', path)
+      assert_equal('Zone/NegativeStdOffsetDst', info.identifier)
+
+      assert_period(:LMT, -100,     0, false,                  nil, 
Time.utc(2000, 1, 1), info)
+      assert_period(:XST, 3600,     0, false, Time.utc(2000, 1, 1), 
Time.utc(2000, 2, 1), info)
+      assert_period(:XWT, 3600, -3600,  true, Time.utc(2000, 2, 1), 
Time.utc(2000, 3, 1), info)
+      assert_period(:XST, 3600,     0, false, Time.utc(2000, 3, 1), 
Time.utc(2000, 4, 1), info)
+      assert_period(:XWT, 3600, -3600,  true, Time.utc(2000, 4, 1), 
Time.utc(2000, 5, 1), info)
+      assert_period(:XST, 3600,     0, false, Time.utc(2000, 5, 1),            
      nil, info)
+    end
+  end
+
+  def test_read_offset_negative_std_offset_dst_initial_dst
+    # The zoneinfo files don't include the offset from standard time, so this
+    # has to be derived by looking at changes in the total UTC offset.
+
+    offsets = [
+      {:gmtoff => -100, :isdst => false, :abbrev => 'LMT'},
+      {:gmtoff =>    0, :isdst => true,  :abbrev => 'XWT'},
+      {:gmtoff => 3600, :isdst => false, :abbrev => 'XST'}]
+
+    transitions = [
+      {:at => Time.utc(2000,  1, 1), :offset_index => 1},
+      {:at => Time.utc(2000,  2, 1), :offset_index => 2},
+      {:at => Time.utc(2000,  3, 1), :offset_index => 1},
+      {:at => Time.utc(2000,  4, 1), :offset_index => 2},
+      {:at => Time.utc(2000,  5, 1), :offset_index => 1}]
+
+    tzif_test(offsets, transitions) do |path, format|
+      info = ZoneinfoTimezoneInfo.new('Zone/NegativeStdOffsetDstInitialDst', 
path)
+      assert_equal('Zone/NegativeStdOffsetDstInitialDst', info.identifier)
+
+      assert_period(:LMT, -100,     0, false,                  nil, 
Time.utc(2000, 1, 1), info)
+      assert_period(:XWT, 3600, -3600,  true, Time.utc(2000, 1, 1), 
Time.utc(2000, 2, 1), info)
+      assert_period(:XST, 3600,     0, false, Time.utc(2000, 2, 1), 
Time.utc(2000, 3, 1), info)
+      assert_period(:XWT, 3600, -3600,  true, Time.utc(2000, 3, 1), 
Time.utc(2000, 4, 1), info)
+      assert_period(:XST, 3600,     0, false, Time.utc(2000, 4, 1), 
Time.utc(2000, 5, 1), info)
+      assert_period(:XWT, 3600, -3600,  true, Time.utc(2000, 5, 1),            
      nil, info)
+    end
+  end
+
+  def test_read_offset_prefer_base_offset_moves_to_dst_not_hour
+    offsets = [
+      {:gmtoff => -100, :isdst => false, :abbrev => 'LMT'},
+      {:gmtoff =>    0, :isdst => false, :abbrev => 'XST'},
+      {:gmtoff => 1800, :isdst => true,  :abbrev => 'XDT'},
+      {:gmtoff => 1800, :isdst => false, :abbrev => 'XST'}]
+
+    transitions = [
+      {:at => Time.utc(2000,  1, 1), :offset_index => 1},
+      {:at => Time.utc(2000,  2, 1), :offset_index => 2},
+      {:at => Time.utc(2000,  3, 1), :offset_index => 3}]
+
+    tzif_test(offsets, transitions) do |path, format|
+      info = ZoneinfoTimezoneInfo.new('Zone/BaseOffsetMovesToDstNotHour', path)
+      assert_equal('Zone/BaseOffsetMovesToDstNotHour', info.identifier)
+
+      assert_period(:LMT, -100,     0, false,                  nil, 
Time.utc(2000, 1, 1), info)
+      assert_period(:XST,    0,     0, false, Time.utc(2000, 1, 1), 
Time.utc(2000, 2, 1), info)
+      assert_period(:XDT,    0,  1800,  true, Time.utc(2000, 2, 1), 
Time.utc(2000, 3, 1), info)
+      assert_period(:XST, 1800,     0, false, Time.utc(2000, 3, 1),            
      nil, info)
+    end
+  end
+
+  def test_read_offset_prefer_base_offset_moves_from_dst_not_hour
+    offsets = [
+      {:gmtoff => -100, :isdst => false, :abbrev => 'LMT'},
+      {:gmtoff => 1800, :isdst => false, :abbrev => 'XST'},
+      {:gmtoff => 1800, :isdst => true,  :abbrev => 'XDT'},
+      {:gmtoff =>    0, :isdst => false, :abbrev => 'XST'}]
+
+    transitions = [
+      {:at => Time.utc(2000,  1, 1), :offset_index => 1},
+      {:at => Time.utc(2000,  2, 1), :offset_index => 2},
+      {:at => Time.utc(2000,  3, 1), :offset_index => 3}]
+
+    tzif_test(offsets, transitions) do |path, format|
+      info = ZoneinfoTimezoneInfo.new('Zone/BaseOffsetMovesFromDstNotHour', 
path)
+      assert_equal('Zone/BaseOffsetMovesFromDstNotHour', info.identifier)
+
+      assert_period(:LMT, -100,     0, false,                  nil, 
Time.utc(2000, 1, 1), info)
+      assert_period(:XST, 1800,     0, false, Time.utc(2000, 1, 1), 
Time.utc(2000, 2, 1), info)
+      assert_period(:XDT,    0,  1800,  true, Time.utc(2000, 2, 1), 
Time.utc(2000, 3, 1), info)
+      assert_period(:XST,    0,     0, false, Time.utc(2000, 3, 1),            
      nil, info)
+    end
+  end
   
   def test_load_in_safe_mode
     offsets = [{:gmtoff => -12094, :isdst => false, :abbrev => 'LT'}]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/test/test_utils.rb new/test/test_utils.rb
--- old/test/test_utils.rb      2017-10-26 23:42:30.000000000 +0200
+++ new/test/test_utils.rb      2018-02-04 20:53:59.000000000 +0100
@@ -60,8 +60,37 @@
    
     if available || options[:unavailable] != :skip
       thread = Thread.new do
-        $SAFE = options[:level] || 1 if available
-        yield
+        orig_diff = Minitest::Assertions.diff
+
+        if available
+          orig_safe = $SAFE
+          $SAFE = options[:level] || 1
+        end
+        begin
+          # Disable the use of external diff tools during safe mode tests 
(since
+          # safe mode will prevent their use). The initial value is retrieved
+          # before activating safe mode because the first time
+          # Minitest::Assertions.diff is called, it will attempt to find a diff
+          # tool. Finding the diff tool will also fail in safe mode.
+          Minitest::Assertions.diff = nil
+          begin
+            yield
+          ensure
+            Minitest::Assertions.diff = orig_diff
+          end
+        ensure
+          if available
+            # On Ruby < 2.6, setting $SAFE affects only the current thread
+            # and the $SAFE level cannot be downgraded. Catch and ignore the
+            # SecurityError.
+            # On Ruby >= 2.6, setting $SAFE is global, and the $SAFE level
+            # can be downgraded. Restore $SAFE back to the original level.
+            begin
+              $SAFE = orig_safe
+            rescue SecurityError
+            end
+          end
+        end
       end
       
       thread.join
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tzinfo.gemspec new/tzinfo.gemspec
--- old/tzinfo.gemspec  2017-10-26 23:42:30.000000000 +0200
+++ new/tzinfo.gemspec  2018-02-04 20:53:59.000000000 +0100
@@ -1,6 +1,6 @@
 Gem::Specification.new do |s|
   s.name = 'tzinfo'
-  s.version = '1.2.4'
+  s.version = '1.2.5'
   s.summary = 'Daylight savings aware timezone library'
   s.description = 'TZInfo provides daylight savings aware transformations 
between times in different time zones.'
   s.author = 'Philip Ross'


Reply via email to