summaryrefslogtreecommitdiff
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
commit15b183c218d488f25567cf126cb379524966746c (patch)
tree8bbea8789258d6d6ee94097c89c3bc8e2a3ca009
parent9a206a80396687c9b0ed9f8c7c5b63d443837f5d (diff)
* 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
-rw-r--r--ChangeLog8
-rw-r--r--strftime.c4
2 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 9d5fc301ef..00ae386d37 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Tue Nov 25 07:51:18 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * 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]
+
Tue Nov 25 03:37:42 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tkextlib/blt/tabset.rb,
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 */