mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix Time#to_a behavior with timezone [Bug #17046]
This commit is contained in:
parent
922fe4da3f
commit
2735da2039
Notes:
git
2020-07-24 20:17:55 +09:00
Merged: https://github.com/ruby/ruby/pull/3355 Merged-By: nobu <nobu@ruby-lang.org>
2 changed files with 7 additions and 1 deletions
|
@ -661,6 +661,12 @@ module TestTimeTZ::WithTZ
|
|||
assert_equal(utc, t.to_i)
|
||||
end
|
||||
|
||||
def subtest_to_a(time_class, tz, tzarg, tzname, abbr, utc_offset)
|
||||
t = time_class.new(2018, 9, 1, 12, 0, 0, tzarg)
|
||||
ary = t.to_a
|
||||
assert_equal(ary, [t.sec, t.min, t.hour, t.mday, t.mon, t.year, t.wday, t.yday, t.isdst, t.zone])
|
||||
end
|
||||
|
||||
def subtest_marshal(time_class, tz, tzarg, tzname, abbr, utc_offset)
|
||||
t = time_class.new(2018, 9, 1, 12, 0, 0, tzarg)
|
||||
t2 = Marshal.load(Marshal.dump(t))
|
||||
|
|
2
time.c
2
time.c
|
@ -4867,7 +4867,7 @@ time_to_a(VALUE time)
|
|||
struct time_object *tobj;
|
||||
|
||||
GetTimeval(time, tobj);
|
||||
MAKE_TM(time, tobj);
|
||||
MAKE_TM_ENSURE(time, tobj, tobj->vtm.yday != 0);
|
||||
return rb_ary_new3(10,
|
||||
INT2FIX(tobj->vtm.sec),
|
||||
INT2FIX(tobj->vtm.min),
|
||||
|
|
Loading…
Add table
Reference in a new issue