summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanaka Akira <akr@fsij.org>2020-01-29 00:01:57 +0900
committerTanaka Akira <akr@fsij.org>2020-01-29 00:01:57 +0900
commit29e31e72fb5a14194a78ec974c4ba56c33ad8d45 (patch)
tree8e1f68815d2bae119b3c8c9d60bb1a907d35dfa3
parent338c5b8c1dc061e9f8d21f6d9f5ac053c4497383 (diff)
ruby_reset_timezone resets leap_second_info.
[Bug #15177]
-rw-r--r--test/ruby/test_time_tz.rb10
-rw-r--r--time.c2
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)
diff --git a/time.c b/time.c
index 7339547527..fcc5f522e1 100644
--- a/time.c
+++ b/time.c
@@ -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