Project

General

Profile

Bug #5226 ยป time_enc.patch

tenderlovemaking (Aaron Patterson), 08/25/2011 06:02 AM

View differences:

test/ruby/test_time.rb
$VERBOSE = @verbose
end
def test_to_s_default_encoding
before = Encoding.default_internal
Encoding.default_internal = nil
assert_equal Encoding::US_ASCII, Time.now.to_s.encoding
ensure
Encoding.default_internal = before
end
def test_to_s_transcoding
before = Encoding.default_internal
Encoding.default_internal = Encoding::UTF_8
assert_equal Encoding::UTF_8, Time.now.to_s.encoding
ensure
Encoding.default_internal = before
end
def test_new
assert_equal(Time.utc(2000,2,10), Time.new(2000,2,10, 11,0,0, 3600*11))
assert_equal(Time.utc(2000,2,10), Time.new(2000,2,9, 13,0,0, -3600*11))
time.c
MAKE_TM(time, tobj);
len = rb_strftime_alloc(&buf, fmt, &tobj->vtm, tobj->timew, TIME_UTC_P(tobj));
str = rb_str_new(buf, len);
rb_enc_associate_index(str, rb_usascii_encindex());
str = rb_str_export_to_enc(str, rb_default_internal_encoding());
if (buf != buffer) xfree(buf);
return str;
}
    (1-1/1)