ruby-changes:8865
From: yugui <ko1@a...>
Date: Sun, 30 Nov 2008 18:23:15 +0900 (JST)
Subject: [ruby-changes:8865] Ruby:r20401 (ruby_1_9_1): merges r20338 from trunk into ruby_1_9_1.
yugui 2008-11-30 18:21:39 +0900 (Sun, 30 Nov 2008) New Revision: 20401 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20401 Log: merges r20338 from trunk into ruby_1_9_1. * strftime.c (rb_strftime): The default precision should be 1, not 0. [ruby-dev:37155] * test/ruby/test_time.rb (test_strftime): ditto. Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/strftime.c branches/ruby_1_9_1/test/ruby/test_time.rb Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 20400) +++ ruby_1_9_1/ChangeLog (revision 20401) @@ -1,3 +1,10 @@ +Mon Nov 24 21:38:23 2008 Shugo Maeda <shugo@r...> + + * strftime.c (rb_strftime): The default precision should be 1, not + 0. [ruby-dev:37155] + + * test/ruby/test_time.rb (test_strftime): ditto. + Mon Nov 24 18:35:00 2008 Yukihiro Matsumoto <matz@r...> * lib/time.rb: r20251 reverted. The patched behavior do not round Index: ruby_1_9_1/strftime.c =================================================================== --- ruby_1_9_1/strftime.c (revision 20400) +++ ruby_1_9_1/strftime.c (revision 20401) @@ -405,7 +405,7 @@ case 'w': /* weekday, Sunday == 0, 0 - 6 */ i = range(0, timeptr->tm_wday, 6); - FMT('0', 0, "d", i); + FMT('0', 1, "d", i); continue; case 'W': /* week of year, Monday is first day of week */ @@ -426,7 +426,7 @@ continue; case 'Y': /* year with century */ - FMT('0', 0, "ld", 1900L + timeptr->tm_year); + FMT('0', 1, "ld", 1900L + timeptr->tm_year); continue; #ifdef MAILHEADER_EXT @@ -623,7 +623,7 @@ case 'u': /* ISO 8601: Weekday as a decimal number [1 (Monday) - 7] */ - FMT('0', 0, "d", timeptr->tm_wday == 0 ? 7 : timeptr->tm_wday); + FMT('0', 1, "d", timeptr->tm_wday == 0 ? 7 : timeptr->tm_wday); continue; #endif /* POSIX2_DATE */ @@ -648,7 +648,7 @@ y = 1900L + timeptr->tm_year; if (*format == 'G') - FMT('0', 0, "ld", y); + FMT('0', 1, "ld", y); else FMT('0', 2, "ld", y % 100); continue; Index: ruby_1_9_1/test/ruby/test_time.rb =================================================================== --- ruby_1_9_1/test/ruby/test_time.rb (revision 20400) +++ ruby_1_9_1/test/ruby/test_time.rb (revision 20401) @@ -444,5 +444,10 @@ assert_equal(" 2", t.strftime("%l")) assert_equal("02", t.strftime("%0l")) assert_equal(" 2", t.strftime("%_l")) + + # [ruby-dev:37155] + t = Time.mktime(1970, 1, 18) + assert_equal("0", t.strftime("%w")) + assert_equal("7", t.strftime("%u")) end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/