From 342cb2406dc473d0dd911c00861673db067c6e5b Mon Sep 17 00:00:00 2001 From: knu Date: Mon, 5 Mar 2007 12:50:08 +0000 Subject: * time.c (time_to_s): Correct the wrong format which did not really conform to RFC 2822; pointed out by: OHARA Shigeki in [ruby-dev:30487]. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_6@11997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ NEWS | 2 +- time.c | 10 +++++----- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 84a526283..cbf08ebc7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Mon Mar 5 20:26:10 2007 Akinori MUSHA + + * time.c (time_to_s): Correct the wrong format which did not + really conform to RFC 2822; pointed out by: OHARA Shigeki in [ruby-dev:30487]. + Sun Mar 4 23:53:27 2007 Minero Aoki * lib/fileutils.rb (mv): could not move a directory between diff --git a/NEWS b/NEWS index f4e16ab28..9a0130ec0 100644 --- a/NEWS +++ b/NEWS @@ -83,7 +83,7 @@ with all sufficient information, see the ChangeLog file. # Before "Wed Mar 03 12:34:56 JST 2007" # After - "Wed, Mar 03 2007 12:34:56 +0900" + "Wed, 03 Mar 2007 12:34:56 +0900" * String#intern now raises SecurityError when $SAFE level is greater than zero. diff --git a/time.c b/time.c index d919c631f..dd5153db6 100644 --- a/time.c +++ b/time.c @@ -1239,11 +1239,11 @@ time_asctime(time) * time.to_s => string * * Returns a string representing time. Equivalent to calling - * Time#strftime with a format string of ``%a - * %b %d %H:%M:%S - * %Z %Y''. + * Time#strftime with a format string of ``%a, + * %d %b %H:%M:%S + * %Z %Y'' (the RFC 2822 style). * - * Time.now.to_s #=> "Wed Apr 09 08:56:04 CDT 2003" + * Time.now.to_s #=> "Wed 09 Apr 08:56:04 CDT 2003" */ static VALUE @@ -1274,7 +1274,7 @@ time_to_s(time) sign = '-'; off = -off; } - sprintf(buf2, "%%a, %%b %%d %%Y %%H:%%M:%%S %c%02d%02d", + sprintf(buf2, "%%a, %%d %%b %%Y %%H:%%M:%%S %c%02d%02d", sign, (int)(off/3600), (int)(off%3600/60)); len = strftime(buf, 128, buf2, &tobj->tm); return rb_str_new(buf, len); -- cgit