1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2018-12-24 01:46:48 +00:00
parent 483c7290f2
commit d747ecc0c4
2 changed files with 5 additions and 0 deletions

View file

@ -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

1
time.c
View file

@ -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;