From aa498028b28b709db51408c0855163cc8adfbb8b Mon Sep 17 00:00:00 2001 From: shugo Date: Mon, 24 Nov 2008 13:10:07 +0000 Subject: [PATCH] * strftime.c (rb_strftime): The precision of %0N should be 9. [ruby-dev:37156] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ strftime.c | 3 +-- test/ruby/test_time.rb | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0a1ab5f545..16e05cf90b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Mon Nov 24 22:07:07 2008 Shugo Maeda + + * 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 * strftime.c (rb_strftime): The default precision should be 1, not diff --git a/strftime.c b/strftime.c index 5565a9be07..2c98164c0b 100644 --- a/strftime.c +++ b/strftime.c @@ -673,8 +673,7 @@ rb_strftime(char *s, size_t maxsize, const char *format, const struct tm *timept { long n = ts->tv_nsec; - if (precision == 0) continue; - if (precision < 0) { + if (precision <= 0) { precision = w; } NEEDS(precision); diff --git a/test/ruby/test_time.rb b/test/ruby/test_time.rb index d3b6982649..b15027c1f8 100644 --- a/test/ruby/test_time.rb +++ b/test/ruby/test_time.rb @@ -396,7 +396,7 @@ class TestTime < Test::Unit::TestCase assert_equal("123456", t.strftime("%6N")) assert_equal("123456789", t.strftime("%9N")) 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("946684800", t.strftime("%s")) assert_equal("946684800", t.utc.strftime("%s"))