Skip to content

Commit

Permalink
Simplifies formatting of RFC1123 dates
Browse files Browse the repository at this point in the history
  • Loading branch information
despeset committed Apr 4, 2013
1 parent b2d71f0 commit 90dc3ac
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Httplib/src/Httplib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ const HttpMethodBitmaskToName = (HttpMethodBitmask => String)[v => k for (k, v)

# Default HTTP headers
# RFC 1123 datetime formatting constants
DAY_NAMES = split("Sun Mon Tue Wed Thu Fri Sat")
RFC1123_FORMAT_STR = "dd MMM yyyy HH:mm:ss"
RFC1123_FORMAT_STR = "EEE, dd MMM yyyy HH:mm:ss"

# Get RFC 1123 datetimes
#
Expand All @@ -115,7 +114,7 @@ RFC1123_FORMAT_STR = "dd MMM yyyy HH:mm:ss"
#
RFC1123_datetime(t::CalendarTime) = begin
t = tz(t,"GMT")
"$(DAY_NAMES[dayofweek(t)]), $(format(RFC1123_FORMAT_STR, t)) GMT"
format(RFC1123_FORMAT_STR, t) * " GMT"
end
RFC1123_datetime() = RFC1123_datetime(now())

Expand Down

0 comments on commit 90dc3ac

Please sign in to comment.