diff options
author | Tanaka Akira <akr@fsij.org> | 2020-01-29 00:01:57 +0900 |
---|---|---|
committer | Tanaka Akira <akr@fsij.org> | 2020-01-29 00:01:57 +0900 |
commit | 29e31e72fb5a14194a78ec974c4ba56c33ad8d45 (patch) | |
tree | 8e1f68815d2bae119b3c8c9d60bb1a907d35dfa3 | |
parent | 338c5b8c1dc061e9f8d21f6d9f5ac053c4497383 (diff) | |
download | ruby-29e31e72fb5a14194a78ec974c4ba56c33ad8d45.tar.gz |
ruby_reset_timezone resets leap_second_info.
[Bug #15177]
-rw-r--r-- | test/ruby/test_time_tz.rb | 10 | ||||
-rw-r--r-- | time.c | 2 |
2 files changed, 5 insertions, 7 deletions
diff --git a/test/ruby/test_time_tz.rb b/test/ruby/test_time_tz.rb index 83482eac65..a95f9e74b4 100644 --- a/test/ruby/test_time_tz.rb +++ b/test/ruby/test_time_tz.rb @@ -219,7 +219,6 @@ class TestTimeTZ < Test::Unit::TestCase 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 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 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) @@ -682,11 +682,13 @@ static int leap_year_p(long y); 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 |