summaryrefslogtreecommitdiffstats
path: root/strftime.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-11-25 00:24:01 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-11-25 00:24:01 +0000
commitab085a095342f35d8ff293f98766caf78528ed4a (patch)
tree8bbea8789258d6d6ee94097c89c3bc8e2a3ca009 /strftime.c
parente5f68b14cd7b49cb281ed6349e96179273408c2d (diff)
downloadruby-ab085a095342f35d8ff293f98766caf78528ed4a.tar.gz
ruby-ab085a095342f35d8ff293f98766caf78528ed4a.tar.xz
ruby-ab085a095342f35d8ff293f98766caf78528ed4a.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@20352 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 d6d1f8bd3..98e193c39 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 */