X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=time-http.git;a=blobdiff_plain;f=Data%2FTime%2FAsctime.hs;fp=Data%2FTime%2FAsctime.hs;h=0000000000000000000000000000000000000000;hp=0814e451f9f0f82e37f849da656740adb0e09103;hb=2064aacf48e193924b6ffe18a50853d233c16b98;hpb=901a3635d37e25a2d4c2e1562c32c68c410fbdd3 diff --git a/Data/Time/Asctime.hs b/Data/Time/Asctime.hs deleted file mode 100644 index 0814e45..0000000 --- a/Data/Time/Asctime.hs +++ /dev/null @@ -1,52 +0,0 @@ -{-# LANGUAGE - UnicodeSyntax - #-} --- |This module provides functions for ANSI C's asctime() format. --- --- ANSI C's asctime() format looks like: --- --- @Wdy Mon [D]D HH:MM:SS YYYY@ --- --- The exact syntax is as follows: --- --- > date-time ::= wday SP month SP day SP time SP year --- > wday ::= "Mon" | "Tue" | "Wed" | "Thu" --- > | "Fri" | "Sat" | "Sun" --- > month ::= "Jan" | "Feb" | "Mar" | "Apr" --- > | "May" | "Jun" | "Jul" | "Aug" --- > | "Sep" | "Oct" | "Nov" | "Dec" --- > day ::= 2DIGIT | SP 1DIGIT --- > time ::= 2DIGIT ':' 2DIGIT [':' 2DIGIT] --- > year ::= 4DIGIT --- --- As you can see, it has no time zone info. "Data.Time.HTTP" will --- treat it as UTC. -module Data.Time.Asctime - ( -- * Formatting - toAscii - , toAsciiBuilder - - -- * Parsing - , fromAscii - , asctime - ) - where -import Data.Ascii (Ascii) -import qualified Data.Ascii as A -import qualified Data.Attoparsec.Char8 as P -import Data.Time -import Data.Time.Asctime.Internal -import Prelude.Unicode - --- |Convert a 'LocalTime' to ANSI C's @asctime()@ string. -toAscii ∷ LocalTime → Ascii -toAscii = A.fromAsciiBuilder ∘ toAsciiBuilder - --- |Parse an ANSI C's @asctime()@ string. When the string can't be --- parsed, it returns @'Left' err@. -fromAscii ∷ Ascii → Either String LocalTime -fromAscii = P.parseOnly p ∘ A.toByteString - where - p = do zt ← asctime - P.endOfInput - return zt