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

merges r20339 from trunk into ruby_1_9_1.

* strftime.c (rb_strftime): The precision of %0N should be 9.
  [ruby-dev:37156]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20402 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
yugui 2008-11-30 09:21:48 +00:00
parent d909830c82
commit cca7d596d4
3 changed files with 9 additions and 3 deletions

View file

@ -1,3 +1,10 @@
Mon Nov 24 22:07:07 2008 Shugo Maeda <shugo@ruby-lang.org>
* strftime.c (rb_strftime): The precision of %0N should be 9.
[ruby-dev:37156]
* test/ruby/test_time.rb (test_strftime): ditto.
Mon Nov 24 21:38:23 2008 Shugo Maeda <shugo@ruby-lang.org> Mon Nov 24 21:38:23 2008 Shugo Maeda <shugo@ruby-lang.org>
* strftime.c (rb_strftime): The default precision should be 1, not * strftime.c (rb_strftime): The default precision should be 1, not

View file

@ -673,8 +673,7 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct tm *timept
{ {
long n = ts->tv_nsec; long n = ts->tv_nsec;
if (precision == 0) continue; if (precision <= 0) {
if (precision < 0) {
precision = w; precision = w;
} }
NEEDS(precision); NEEDS(precision);

View file

@ -396,7 +396,7 @@ class TestTime < Test::Unit::TestCase
assert_equal("123456", t.strftime("%6N")) assert_equal("123456", t.strftime("%6N"))
assert_equal("123456789", t.strftime("%9N")) assert_equal("123456789", t.strftime("%9N"))
assert_equal("1234567890", t.strftime("%10N")) assert_equal("1234567890", t.strftime("%10N"))
assert_equal("", t.strftime("%0N")) assert_equal("123456789", t.strftime("%0N"))
assert_equal("000", t.strftime("%3S")) assert_equal("000", t.strftime("%3S"))
assert_equal("946684800", t.strftime("%s")) assert_equal("946684800", t.strftime("%s"))
assert_equal("946684800", t.utc.strftime("%s")) assert_equal("946684800", t.utc.strftime("%s"))