aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--strftime.c1
-rw-r--r--test/ruby/test_time.rb2
2 files changed, 2 insertions, 1 deletions
diff --git a/strftime.c b/strftime.c
index 42761f0d7c..81e56d1f7b 100644
--- a/strftime.c
+++ b/strftime.c
@@ -326,6 +326,7 @@ rb_strftime_with_timespec(VALUE ftime, const char *format, size_t format_len,
const char *fmts = FMT_PADDING(fmt, def_pad); \
precision = FMT_PRECISION(def_prec); \
tmp = format_value(fmts, tmp, precision); \
+ rb_str_set_len(ftime, s-start); \
rb_str_append(ftime, tmp); \
RSTRING_GETMEM(ftime, s, len); \
endp = (start = s) + rb_str_capacity(ftime); \
diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb
index bf38374f62..c75cffaacf 100644
--- a/test/ruby/test_time.rb
+++ b/test/ruby/test_time.rb
@@ -758,7 +758,7 @@ class TestTime < Test::Unit::TestCase
assert_equal("-0001", t.strftime("%G"))
t = Time.utc(10000000000000000000000,1,1)
- assert_equal("10000000000000000000000", t.strftime("%Y"))
+ assert_equal("<<10000000000000000000000>>", t.strftime("<<%Y>>"))
end
def test_strftime_weeknum