summaryrefslogtreecommitdiff
path: root/strftime.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-11-30 09:23:04 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-11-30 09:23:04 +0000
commit5fe983bd471349a75cef3e729547173f3a621ed2 (patch)
tree221e548c25fc2c1da9d98c3aa41d1b885956a525 /strftime.c
parentf4272defc7410daebbb9168d8a3084121d4383e5 (diff)
merges r20352 from trunk into ruby_1_9_1.
* strftime.c (FMT): use "%0d" formatter for zero padding, not "%.d". [ruby-dev:37168] fix: #768 * strftime.c (rb_strftime): %s to use zero padding by default. [ruby-dev:37180] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'strftime.c')
-rw-r--r--strftime.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/strftime.c b/strftime.c
index d6d1f8bd3a..98e193c396 100644
--- a/strftime.c
+++ b/strftime.c
@@ -286,7 +286,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 == '0' || (!padding && def_pad == '0')) ? "%.*"fmt : "%*"fmt), \
+ ((padding == '0' || (!padding && def_pad == '0')) ? "%0*"fmt : "%*"fmt), \
precision, val); \
if (l < 0) goto err; \
s += l; \
@@ -417,7 +417,7 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct tm *timept
break;
case 's':
- FMT(' ', 1, "d", (int) ts->tv_sec);
+ FMT('0', 1, "d", (int) ts->tv_sec);
continue;
case 'S': /* second, 00 - 60 */