1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
matz 2008-11-25 00:24:01 +00:00
parent 9a206a8039
commit 15b183c218
2 changed files with 10 additions and 2 deletions

View file

@ -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> Tue Nov 25 03:37:42 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tkextlib/blt/tabset.rb, * ext/tk/lib/tkextlib/blt/tabset.rb,

View file

@ -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 (precision <= 0) precision = (def_prec); \
if (flags & BIT_OF(LEFT)) precision = 1; \ if (flags & BIT_OF(LEFT)) precision = 1; \
l = snprintf(s, endp - s, \ l = snprintf(s, endp - s, \
((padding == '0' || (!padding && def_pad == '0')) ? "%.*"fmt : "%*"fmt), \ ((padding == '0' || (!padding && def_pad == '0')) ? "%0*"fmt : "%*"fmt), \
precision, val); \ precision, val); \
if (l < 0) goto err; \ if (l < 0) goto err; \
s += l; \ s += l; \
@ -417,7 +417,7 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct tm *timept
break; break;
case 's': case 's':
FMT(' ', 1, "d", (int) ts->tv_sec); FMT('0', 1, "d", (int) ts->tv_sec);
continue; continue;
case 'S': /* second, 00 - 60 */ case 'S': /* second, 00 - 60 */