]> gitweb @ CieloNegro.org - time-http.git/blobdiff - Data/Time/Format/HTTP.hs
Rename Asctime -> C
[time-http.git] / Data / Time / Format / HTTP.hs
index 2dd3aad7e93db660cc6efc2e0690a0029480999e..2c44147295cbe03ce0d0668600a3b13fce0f6492 100644 (file)
@@ -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