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

* time.c (timelocalw): Set tm_isdst field -1 if vtm->isdst is

VTM_ISDST_INITVAL.  This bug is introduced at packing struct
  vtm (r45155).
  [ruby-core:67345] [Bug #10698] Reported by Boris Ruf.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2015-01-06 12:41:20 +00:00
parent c0ee6f2af9
commit 9bbe6b9d0c
3 changed files with 16 additions and 1 deletions

View file

@ -1,3 +1,10 @@
Tue Jan 6 21:41:04 2015 Tanaka Akira <akr@fsij.org>
* time.c (timelocalw): Set tm_isdst field -1 if vtm->isdst is
VTM_ISDST_INITVAL. This bug is introduced at packing struct
vtm (r45155).
[ruby-core:67345] [Bug #10698] Reported by Boris Ruf.
Tue Jan 6 03:10:54 2015 Koichi Sasada <ko1@atdot.net>
* test/fiddle/test_handle.rb: fix syntax.

View file

@ -155,6 +155,14 @@ class TestTimeTZ < Test::Unit::TestCase
}
end
def test_europe_berlin
with_tz(tz="Europe/Berlin") {
assert_time_constructor(tz, "2011-10-30 02:00:00 +0100", :local, [2011,10,30,2,0,0], "[ruby-core:67345] [Bug #10698]")
assert_time_constructor(tz, "2011-10-30 02:00:00 +0100", :local, [0,0,2,30,10,2011,nil,nil,false,nil])
assert_time_constructor(tz, "2011-10-30 02:00:00 +0200", :local, [0,0,2,30,10,2011,nil,nil,true,nil])
}
end
def test_europe_lisbon
with_tz("Europe/Lisbon") {
assert_equal("LMT", Time.new(-0x1_0000_0000_0000_0000).zone)

2
time.c
View file

@ -1548,7 +1548,7 @@ timelocalw(struct vtm *vtm)
tm.tm_hour = vtm->hour;
tm.tm_min = vtm->min;
tm.tm_sec = vtm->sec;
tm.tm_isdst = vtm->isdst;
tm.tm_isdst = vtm->isdst == VTM_ISDST_INITVAL ? -1 : vtm->isdst;
if (find_time_t(&tm, 0, &t))
goto no_localtime;