fromC c = ord c - ord '0'
show4digitsTZ ∷ TimeZone → AsciiBuilder
+{-# INLINEABLE show4digitsTZ #-}
show4digitsTZ tz
= case timeZoneMinutes tz of
offset | offset < 0 → A.toAsciiBuilder "-" ⊕ showTZ' (negate offset)
show2 h ⊕ show2 m
read4digitsTZ ∷ Parser TimeZone
+{-# INLINEABLE read4digitsTZ #-}
read4digitsTZ
= do sign ← (char '+' *> return 1)
<|>
import Data.Attoparsec.Char8
import Data.Time
import qualified Data.Time.RFC1123.Internal as RFC1123
-import qualified Data.Time.RFC733.Internal as RFC733
-import qualified Data.Time.Asctime as Asctime
+import Data.Time.RFC733
+import Data.Time.Asctime
import Prelude.Unicode
-- |Parse a date and time string in any formats allowed by HTTP\/1.1
httpDateAndTime ∷ Parser UTCTime
httpDateAndTime
= choice [ zonedTimeToUTC <$> try RFC1123.rfc1123DateAndTime
- , zonedTimeToUTC <$> try RFC733.rfc733DateAndTime
- , localTimeToUTC utc <$> Asctime.asctime
+ , zonedTimeToUTC <$> try rfc733DateAndTime
+ , localTimeToUTC utc <$> asctime
]
-- |Convert a 'UTCTime' to RFC 1123 date and time string.