From d747ecc0c41a7a138c0ae6112356707725653a3e Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 24 Dec 2018 01:46:48 +0000 Subject: [PATCH] time.c: zone in fixoff mode * time.c (time_set_utc_offset): reset zone when setting to fixoff mode. while previously TZMODE_SET_FIXOFF has reset it always, the zone is kept for loaded zone since r65025. [ruby-core:90627] [Bug #15439] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_time.rb | 4 ++++ time.c | 1 + 2 files changed, 5 insertions(+) diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb index 7c5ee5466d..2bd4bc8455 100644 --- a/test/ruby/test_time.rb +++ b/test/ruby/test_time.rb @@ -556,6 +556,10 @@ class TestTime < Test::Unit::TestCase def test_zone assert_zone_encoding Time.now + t = Time.now.utc + assert_equal("UTC", t.zone) + assert_nil(t.getlocal(0).zone) + assert_nil(t.getlocal("+02:00").zone) end def test_plus_minus_succ diff --git a/time.c b/time.c index abe64c7170..3bbfce6b38 100644 --- a/time.c +++ b/time.c @@ -1896,6 +1896,7 @@ time_set_utc_offset(VALUE time, VALUE off) GetTimeval(time, tobj); tobj->tm_got = 0; + tobj->vtm.zone = Qnil; TZMODE_SET_FIXOFF(tobj, off); return time;