[前][次][番号順一覧][スレッド一覧]

ruby-changes:59858

From: Tanaka <ko1@a...>
Date: Wed, 29 Jan 2020 00:02:39 +0900 (JST)
Subject: [ruby-changes:59858] 29e31e72fb (master): ruby_reset_timezone resets leap_second_info.

https://git.ruby-lang.org/ruby.git/commit/?id=29e31e72fb

From 29e31e72fb5a14194a78ec974c4ba56c33ad8d45 Mon Sep 17 00:00:00 2001
From: Tanaka Akira <akr@f...>
Date: Wed, 29 Jan 2020 00:01:57 +0900
Subject: ruby_reset_timezone resets leap_second_info.

[Bug #15177]

diff --git a/test/ruby/test_time_tz.rb b/test/ruby/test_time_tz.rb
index 83482ea..a95f9e7 100644
--- a/test/ruby/test_time_tz.rb
+++ b/test/ruby/test_time_tz.rb
@@ -219,7 +219,6 @@ class TestTimeTZ < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_time_tz.rb#L219
 
   def test_right_utc
     with_tz(tz="right/UTC") {
-      ::Bug::Time.reset_leap_second_info
       assert_time_constructor(tz, "2008-12-31 23:59:59 UTC", :utc, [2008,12,31,23,59,59])
       assert_time_constructor(tz, "2008-12-31 23:59:60 UTC", :utc, [2008,12,31,23,59,60])
       assert_time_constructor(tz, "2009-01-01 00:00:00 UTC", :utc, [2008,12,31,24,0,0])
@@ -229,25 +228,23 @@ class TestTimeTZ < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_time_tz.rb#L228
 
   def test_right_utc_switching
     with_tz("UTC") { # ensure no leap second timezone
-      ::Bug::Time.reset_leap_second_info
       assert_equal(4102444800, Time.utc(2100,1,1,0,0,0).to_i)
       with_tz(tz="right/UTC") {
         assert_time_constructor(tz, "2008-12-31 23:59:59 UTC", :utc, [2008,12,31,23,59,59])
-        assert_time_constructor(tz, "2009-01-01 00:00:00 UTC", :utc, [2008,12,31,23,59,60])
+        assert_time_constructor(tz, "2008-12-31 23:59:60 UTC", :utc, [2008,12,31,23,59,60])
         assert_time_constructor(tz, "2009-01-01 00:00:00 UTC", :utc, [2008,12,31,24,0,0])
         assert_time_constructor(tz, "2009-01-01 00:00:00 UTC", :utc, [2009,1,1,0,0,0])
-        assert_equal(4102444800, Time.utc(2100,1,1,0,0,0).to_i)
+        assert_not_equal(4102444800, Time.utc(2100,1,1,0,0,0).to_i)
       }
     }
     with_tz("right/UTC") {
-      ::Bug::Time.reset_leap_second_info
       assert_not_equal(4102444800, Time.utc(2100,1,1,0,0,0).to_i)
       with_tz(tz="UTC") {
         assert_time_constructor(tz, "2008-12-31 23:59:59 UTC", :utc, [2008,12,31,23,59,59])
         assert_time_constructor(tz, "2009-01-01 00:00:00 UTC", :utc, [2008,12,31,23,59,60])
         assert_time_constructor(tz, "2009-01-01 00:00:00 UTC", :utc, [2008,12,31,24,0,0])
         assert_time_constructor(tz, "2009-01-01 00:00:00 UTC", :utc, [2009,1,1,0,0,0])
-        assert_not_equal(4102444800, Time.utc(2100,1,1,0,0,0).to_i)
+        assert_equal(4102444800, Time.utc(2100,1,1,0,0,0).to_i)
       }
     }
   end if has_right_tz
@@ -376,7 +373,6 @@ class TestTimeTZ < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_time_tz.rb#L373
       mesg = "#{mesg_utc}.localtime"
       define_method(gen_test_name(tz)) {
         with_tz(tz) {
-          ::Bug::Time.reset_leap_second_info
           t = nil
           assert_nothing_raised(mesg) { t = Time.utc(*u) }
           assert_equal(expected_utc, time_to_s(t), mesg_utc)
diff --git a/time.c b/time.c
index 7339547..fcc5f52 100644
--- a/time.c
+++ b/time.c
@@ -682,11 +682,13 @@ static int leap_year_p(long y); https://github.com/ruby/ruby/blob/trunk/time.c#L682
 static VALUE tm_from_time(VALUE klass, VALUE time);
 
 bool ruby_tz_uptodate_p;
+void ruby_reset_leap_second_info(void);
 
 void
 ruby_reset_timezone(void)
 {
     ruby_tz_uptodate_p = false;
+    ruby_reset_leap_second_info();
 }
 
 static void
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]