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:
parent
9f31706636
commit
77d7a80f97
3 changed files with 40 additions and 1 deletions
|
@ -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; \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue