X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=time-http.git;a=blobdiff_plain;f=Data%2FTime%2FFormat%2FHTTP.hs;fp=Data%2FTime%2FFormat%2FHTTP.hs;h=2c44147295cbe03ce0d0668600a3b13fce0f6492;hp=2dd3aad7e93db660cc6efc2e0690a0029480999e;hb=feaeeec98ab53936e6d2f041eb43b8717bd21235;hpb=c8df2ef29fb3e1141a2480a0ae834386bc235fc5 diff --git a/Data/Time/Format/HTTP.hs b/Data/Time/Format/HTTP.hs index 2dd3aad..2c44147 100644 --- a/Data/Time/Format/HTTP.hs +++ b/Data/Time/Format/HTTP.hs @@ -46,6 +46,7 @@ -- > | "Sep" | "Oct" | "Nov" | "Dec" module Data.Time.Format.HTTP ( HTTP + , http , httpDateAndTime ) where @@ -57,7 +58,7 @@ import Data.Convertible.Base import Data.Proxy import Data.Tagged import Data.Time -import Data.Time.Format.Asctime +import Data.Time.Format.C import Data.Time.Format.HTTP.Common import Data.Time.Format.RFC733 import Data.Time.Format.RFC822 @@ -71,6 +72,12 @@ import Prelude.Unicode -- Tagged "Sun, 06 Nov 1994 08:49:37 GMT" data HTTP +-- |The proxy for conversions between ANSI HTTP/1.1 date and time +-- strings and 'UTCTime'. +http ∷ Proxy HTTP +{-# INLINE CONLIKE http #-} +http = Proxy + instance ConvertSuccess UTCTime (Tagged HTTP Ascii) where {-# INLINE convertSuccess #-} convertSuccess = (A.fromAsciiBuilder <$>) ∘ cs @@ -96,17 +103,13 @@ httpDateAndTime = choice [ zonedTimeToUTC <$> try rfc1123DateAndTime , zonedTimeToUTC <$> try rfc733DateAndTime , zonedTimeToUTC <$> try rfc822DateAndTime - , localTimeToUTC utc <$> asctime + , localTimeToUTC utc <$> cDateAndTime ] toAsciiBuilder ∷ UTCTime → AsciiBuilder {-# INLINE toAsciiBuilder #-} toAsciiBuilder = flip proxy rfc1123 ∘ cs ∘ ut2zt where - rfc1123 ∷ Proxy RFC1123 - {-# INLINE CONLIKE rfc1123 #-} - rfc1123 = Proxy - ut2zt ∷ UTCTime → ZonedTime {-# INLINE ut2zt #-} ut2zt = utcToZonedTime gmt