diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-11-25 00:24:01 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-11-25 00:24:01 +0000 |
commit | 15b183c218d488f25567cf126cb379524966746c (patch) | |
tree | 8bbea8789258d6d6ee94097c89c3bc8e2a3ca009 /strftime.c | |
parent | 9a206a80396687c9b0ed9f8c7c5b63d443837f5d (diff) | |
download | ruby-15b183c218d488f25567cf126cb379524966746c.tar.gz |
* 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/trunk@20352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'strftime.c')
-rw-r--r-- | strftime.c | 4 |
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 */ |