ruby-changes:23365
From: nobu <ko1@a...>
Date: Sat, 21 Apr 2012 07:16:36 +0900 (JST)
Subject: [ruby-changes:23365] nobu:r35416 (ruby_1_9_3): merge revision(s) 35366,35377,35399,35406:
nobu 2012-04-21 07:16:21 +0900 (Sat, 21 Apr 2012) New Revision: 35416 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35416 Log: merge revision(s) 35366,35377,35399,35406: * strftime.c (rb_strftime_with_timespec): fix padding of time zone offset. [ruby-dev:43287][Bug #4458] * strftime.c (rb_strftime_with_timespec): add an interim digit for the timezone offset which is less than an hour. * strftime.c (rb_strftime_with_timespec): fix carry-up bug and overwrite '+' with '-' if negative offset less than a hour. [ruby-core:44447][Bug #6323] Modified files: branches/ruby_1_9_3/ChangeLog branches/ruby_1_9_3/strftime.c branches/ruby_1_9_3/test/ruby/test_time.rb branches/ruby_1_9_3/version.h Index: ruby_1_9_3/ChangeLog =================================================================== --- ruby_1_9_3/ChangeLog (revision 35415) +++ ruby_1_9_3/ChangeLog (revision 35416) @@ -1,3 +1,15 @@ +Sat Apr 21 07:16:16 2012 Nobuyoshi Nakada <nobu@r...> + + * strftime.c (rb_strftime_with_timespec): fix padding of time zone + offset. [ruby-dev:43287][Bug #4458] + + * strftime.c (rb_strftime_with_timespec): add an interim digit for + the timezone offset which is less than an hour. + + * strftime.c (rb_strftime_with_timespec): fix carry-up bug and + overwrite '+' with '-' if negative offset less than a hour. + [ruby-core:44447][Bug #6323] + Fri Apr 20 12:30:06 2012 Eric Hodel <drbrain@s...> * lib/rubygems/ssl_certs/AddTrustExternalCARoot.pem: Removed to avoid Index: ruby_1_9_3/strftime.c =================================================================== --- ruby_1_9_3/strftime.c (revision 35415) +++ ruby_1_9_3/strftime.c (revision 35416) @@ -182,6 +182,9 @@ char padding; enum {LEFT, CHCASE, LOWER, UPPER, LOCALE_O, LOCALE_E}; #define BIT_OF(n) (1U<<(n)) +#ifdef MAILHEADER_EXT + int sign; +#endif /* various tables, useful in North America */ static const char days_l[][10] = { @@ -473,12 +476,16 @@ } if (off < 0) { off = -off; - *s++ = '-'; + sign = -1; } else { - *s++ = '+'; + sign = +1; } - i = snprintf(s, endp - s, (padding == ' ' ? "%*ld" : "%.*ld"), precision, off / 3600); + i = snprintf(s, endp - s, (padding == ' ' ? "%+*ld" : "%+.*ld"), + precision + 1, sign * (off / 3600)); if (i < 0) goto err; + if (sign < 0 && off < 3600) { + *(padding == ' ' ? s + i - 2 : s) = '-'; + } s += i; off = off % 3600; if (1 <= colons) Index: ruby_1_9_3/version.h =================================================================== --- ruby_1_9_3/version.h (revision 35415) +++ ruby_1_9_3/version.h (revision 35416) @@ -1,10 +1,10 @@ #define RUBY_VERSION "1.9.3" -#define RUBY_PATCHLEVEL 195 +#define RUBY_PATCHLEVEL 196 -#define RUBY_RELEASE_DATE "2012-04-20" +#define RUBY_RELEASE_DATE "2012-04-21" #define RUBY_RELEASE_YEAR 2012 #define RUBY_RELEASE_MONTH 4 -#define RUBY_RELEASE_DAY 20 +#define RUBY_RELEASE_DAY 21 #include "ruby/version.h" Index: ruby_1_9_3/test/ruby/test_time.rb =================================================================== --- ruby_1_9_3/test/ruby/test_time.rb (revision 35415) +++ ruby_1_9_3/test/ruby/test_time.rb (revision 35416) @@ -659,6 +659,38 @@ bug4457 = '[ruby-dev:43285]' assert_raise(Errno::ERANGE, bug4457) {Time.now.strftime('%8192z')} + + bug4458 = '[ruby-dev:43287]' + t = T2000.getlocal("+09:00") + assert_equal(" +900", t.strftime("%_10z"), bug4458) + assert_equal("+000000900", t.strftime("%10z"), bug4458) + assert_equal(" +9:00", t.strftime("%_:10z"), bug4458) + assert_equal("+000009:00", t.strftime("%:10z"), bug4458) + assert_equal(" +9:00:00", t.strftime("%_::10z"), bug4458) + assert_equal("+009:00:00", t.strftime("%::10z"), bug4458) + t = T2000.getlocal("-05:00") + assert_equal(" -500", t.strftime("%_10z"), bug4458) + assert_equal("-000000500", t.strftime("%10z"), bug4458) + assert_equal(" -5:00", t.strftime("%_:10z"), bug4458) + assert_equal("-000005:00", t.strftime("%:10z"), bug4458) + assert_equal(" -5:00:00", t.strftime("%_::10z"), bug4458) + assert_equal("-005:00:00", t.strftime("%::10z"), bug4458) + + bug6323 = '[ruby-core:44447]' + t = T2000.getlocal("+00:36") + assert_equal(" +036", t.strftime("%_10z"), bug6323) + assert_equal("+000000036", t.strftime("%10z"), bug6323) + assert_equal(" +0:36", t.strftime("%_:10z"), bug6323) + assert_equal("+000000:36", t.strftime("%:10z"), bug6323) + assert_equal(" +0:36:00", t.strftime("%_::10z"), bug6323) + assert_equal("+000:36:00", t.strftime("%::10z"), bug6323) + t = T2000.getlocal("-00:55") + assert_equal(" -055", t.strftime("%_10z"), bug6323) + assert_equal("-000000055", t.strftime("%10z"), bug6323) + assert_equal(" -0:55", t.strftime("%_:10z"), bug6323) + assert_equal("-000000:55", t.strftime("%:10z"), bug6323) + assert_equal(" -0:55:00", t.strftime("%_::10z"), bug6323) + assert_equal("-000:55:00", t.strftime("%::10z"), bug6323) end def test_delegate -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/