@@ -666,30 +666,10 @@ def xmlschema(time)
666666 # You must require 'time' to use this method.
667667 #
668668 def rfc2822
669- sprintf ( '%s, %02d %s %0*d %02d:%02d:%02d ' ,
670- RFC2822_DAY_NAME [ wday ] ,
671- day , RFC2822_MONTH_NAME [ mon -1 ] , year < 0 ? 5 : 4 , year ,
672- hour , min , sec ) <<
673- if utc?
674- '-0000'
675- else
676- off = utc_offset
677- sign = off < 0 ? '-' : '+'
678- sprintf ( '%s%02d%02d' , sign , *( off . abs / 60 ) . divmod ( 60 ) )
679- end
669+ strftime ( '%a, %d %b %Y %T ' ) << ( utc? ? '-0000' : strftime ( '%z' ) )
680670 end
681671 alias rfc822 rfc2822
682672
683-
684- RFC2822_DAY_NAME = [ # :nodoc:
685- 'Sun' , 'Mon' , 'Tue' , 'Wed' , 'Thu' , 'Fri' , 'Sat'
686- ]
687-
688- RFC2822_MONTH_NAME = [ # :nodoc:
689- 'Jan' , 'Feb' , 'Mar' , 'Apr' , 'May' , 'Jun' ,
690- 'Jul' , 'Aug' , 'Sep' , 'Oct' , 'Nov' , 'Dec'
691- ]
692-
693673 #
694674 # Returns a string which represents the time as RFC 1123 date of HTTP-date
695675 # defined by RFC 2616:
@@ -706,11 +686,7 @@ def rfc2822
706686 # You must require 'time' to use this method.
707687 #
708688 def httpdate
709- t = dup . utc
710- sprintf ( '%s, %02d %s %0*d %02d:%02d:%02d GMT' ,
711- RFC2822_DAY_NAME [ t . wday ] ,
712- t . day , RFC2822_MONTH_NAME [ t . mon -1 ] , t . year < 0 ? 5 : 4 , t . year ,
713- t . hour , t . min , t . sec )
689+ getutc . strftime ( '%a, %d %b %Y %T GMT' )
714690 end
715691
716692 #
0 commit comments