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

* strftime.c (rb_strftime): fixed a bug of padding.

* test/ruby/test_time.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2008-08-28 15:54:44 +00:00
parent 9f31706636
commit 77d7a80f97
3 changed files with 40 additions and 1 deletions

View file

@ -277,7 +277,7 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct tm *timept
if (precision <= 0) precision = (def_prec); \
if (flags & BIT_OF(LEFT)) precision = 1; \
l = snprintf(s, endp - s, \
((!padding || padding == (def_pad)) ? "%.*"fmt : "%*"fmt), \
((padding == '0' || (!padding && def_pad == '0')) ? "%.*"fmt : "%*"fmt), \
precision, val); \
if (l < 0) goto err; \
s += l; \