From 77d7a80f9778d415165fff1c7ce0bf99b96b9ef3 Mon Sep 17 00:00:00 2001 From: shugo Date: Thu, 28 Aug 2008 15:54:44 +0000 Subject: * 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 --- strftime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'strftime.c') diff --git a/strftime.c b/strftime.c index 2b8033cf28..fa0e6e6a69 100644 --- a/strftime.c +++ b/strftime.c @@ -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; \ -- cgit v1.2.3