From d9dd33fc27fc2108e78dd60cc0b37042bd39f5fd Mon Sep 17 00:00:00 2001 From: akr Date: Tue, 21 Apr 2009 18:08:47 +0000 Subject: * lib/time.rb (Time#rfc2822): pad leading zeros for year. (Time#httpdate): ditto. (Time#xmlschema): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/time.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/time.rb b/lib/time.rb index da5bec9ff3..37da4e381d 100644 --- a/lib/time.rb +++ b/lib/time.rb @@ -445,7 +445,7 @@ class Time # If +self+ is a UTC time, -0000 is used as zone. # def rfc2822 - sprintf('%s, %02d %s %d %02d:%02d:%02d ', + sprintf('%s, %02d %s %04d %02d:%02d:%02d ', RFC2822_DAY_NAME[wday], day, RFC2822_MONTH_NAME[mon-1], year, hour, min, sec) + @@ -477,7 +477,7 @@ class Time # def httpdate t = dup.utc - sprintf('%s, %02d %s %d %02d:%02d:%02d GMT', + sprintf('%s, %02d %s %04d %02d:%02d:%02d GMT', RFC2822_DAY_NAME[t.wday], t.day, RFC2822_MONTH_NAME[t.mon-1], t.year, t.hour, t.min, t.sec) @@ -498,7 +498,7 @@ class Time # Its default value is 0. # def xmlschema(fraction_digits=0) - sprintf('%d-%02d-%02dT%02d:%02d:%02d', + sprintf('%04d-%02d-%02dT%02d:%02d:%02d', year, mon, day, hour, min, sec) + if fraction_digits == 0 '' -- cgit v1.2.3