summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-24 01:46:48 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-24 01:46:48 (GMT)
commitd747ecc0c41a7a138c0ae6112356707725653a3e (patch)
tree8c001e2cf6e4d56230a6231e7ce6553fd148bfb6
parent483c7290f2509a9d5a3e193a66689971394d4de8 (diff)
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
-rw-r--r--test/ruby/test_time.rb4
-rw-r--r--time.c1
2 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb
index 7c5ee54..2bd4bc8 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 abe64c7..3bbfce6 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;