Bug #7445 » bug-7445.patch
| ext/date/date_core.c | ||
|---|---|---|
|
static VALUE
|
||
|
rt_rewrite_frags(VALUE hash)
|
||
|
{
|
||
|
VALUE seconds;
|
||
|
VALUE seconds, offset;
|
||
|
seconds = ref_hash("seconds");
|
||
|
if (!NIL_P(seconds)) {
|
||
|
VALUE d, h, min, s, fr;
|
||
|
offset = ref_hash("offset");
|
||
|
if(!NIL_P(offset)) {
|
||
|
seconds = f_add(seconds, offset);
|
||
|
}
|
||
|
d = f_idiv(seconds, INT2FIX(DAY_IN_SECONDS));
|
||
|
fr = f_mod(seconds, INT2FIX(DAY_IN_SECONDS));
|
||
| ... | ... | |
|
set_hash("sec", s);
|
||
|
set_hash("sec_fraction", fr);
|
||
|
del_hash("seconds");
|
||
|
del_hash("offset");
|
||
|
}
|
||
|
return hash;
|
||
|
}
|
||
| test/date/test_date_strptime.rb | ||
|---|---|---|
|
DateTime.strptime('2002-03-14T11:22:33.123456789-09:00', '%FT%T.%N%Z'))
|
||
|
end
|
||
|
def test_strptime_bug_7445
|
||
|
d = DateTime.strptime('0 +0100', '%s %z')
|
||
|
assert_equal Rational(1, 24), d.offset
|
||
|
assert_equal 0, d.second
|
||
|
end
|
||
|
def test_strptime__2
|
||
|
n = 10**9
|
||
|
(Date.new(2006,6,1)..Date.new(2007,6,1)).each do |d|
|
||