Skip to content

Commit caf1d07

Browse files
committed
Use Time#strftime
1 parent c42f915 commit caf1d07

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

lib/cgi/util.rb

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -179,21 +179,12 @@ def unescapeElement(string, *elements)
179179
# Synonym for CGI.unescapeElement(str)
180180
alias unescape_element unescapeElement
181181

182-
# Abbreviated day-of-week names specified by RFC 822
183-
RFC822_DAYS = %w[ Sun Mon Tue Wed Thu Fri Sat ]
184-
185-
# Abbreviated month names specified by RFC 822
186-
RFC822_MONTHS = %w[ Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ]
187-
188182
# Format a +Time+ object as a String using the format specified by RFC 1123.
189183
#
190184
# CGI.rfc1123_date(Time.now)
191185
# # Sat, 01 Jan 2000 00:00:00 GMT
192186
def rfc1123_date(time)
193-
t = time.clone.gmtime
194-
return format("%s, %.2d %s %.4d %.2d:%.2d:%.2d GMT",
195-
RFC822_DAYS[t.wday], t.day, RFC822_MONTHS[t.month-1], t.year,
196-
t.hour, t.min, t.sec)
187+
time.getgm.strftime("%a, %d %b %Y %T GMT")
197188
end
198189

199190
# Prettify (indent) an HTML string.

0 commit comments

Comments
 (0)