]> gitweb @ CieloNegro.org - time-http.git/blobdiff - Data/Time/Format/Asctime.hs
Rename modules
[time-http.git] / Data / Time / Format / Asctime.hs
similarity index 70%
rename from Data/Time/Asctime.hs
rename to Data/Time/Format/Asctime.hs
index f8d28ccd80091fb0424c779245aaa6627d50068a..8e280b54f4cf1e860b07604ecb53e912f22d3b4b 100644 (file)
@@ -5,9 +5,9 @@
   , TemplateHaskell
   , UnicodeSyntax
   #-}
--- |This module provides functions for ANSI C's asctime() format.
+-- |This module provides functions for ANSI C's date and time strings.
 --
--- ANSI C's asctime() format looks like:
+-- ANSI C's @ctime(3)@/@asctime(3)@ format looks like:
 --
 -- @Wdy Mon [D]D HH:MM:SS YYYY@
 --
 -- > 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
+module Data.Time.Format.Asctime
     ( Asctime
     , asctime
     )
@@ -39,10 +36,10 @@ import Data.Monoid.Unicode
 import Data.Tagged
 import Data.Time
 import Data.Time.Calendar.WeekDate
-import Data.Time.HTTP.Common
+import Data.Time.Format.HTTP.Common
 import Prelude.Unicode
 
--- |The phantom type for conversion between ANSI C's @asctime()@
+-- |The phantom type for conversions between ANSI C's date and time
 -- string and 'LocalTime'.
 --
 -- >>> convertSuccess (LocalTime (ModifiedJulianDay 49662) (TimeOfDay 8 49 37))
@@ -61,27 +58,28 @@ instance ConvertAttempt (Tagged Asctime Ascii) LocalTime where
     {-# INLINE convertAttempt #-}
     convertAttempt = parseAttempt' asctime ∘ untag
 
--- |Parse an ANSI C's @asctime()@ string.
+-- |Parse an ANSI C's date and time string.
 asctime ∷ Parser LocalTime
-asctime = do weekDay ← shortWeekDayNameP
-             _       ← char ' '
-             month   ← shortMonthNameP
-             _       ← char ' '
-             day     ← read2'
-             _       ← char ' '
-             hour    ← read2
-             _       ← char ':'
-             minute  ← read2
-             _       ← char ':'
-             second  ← read2
-             _       ← char ' '
-             year    ← read4
+asctime
+    = do weekDay ← shortWeekDayNameP
+         _       ← char ' '
+         month   ← shortMonthNameP
+         _       ← char ' '
+         day     ← read2'
+         _       ← char ' '
+         hour    ← read2
+         _       ← char ':'
+         minute  ← read2
+         _       ← char ':'
+         second  ← read2
+         _       ← char ' '
+         year    ← read4
 
-             gregDay ← assertGregorianDateIsGood year month day
-             _       ← assertWeekDayIsGood weekDay gregDay
-             tod     ← assertTimeOfDayIsGood hour minute second
+         gregDay ← assertGregorianDateIsGood year month day
+         _       ← assertWeekDayIsGood weekDay gregDay
+         tod     ← assertTimeOfDayIsGood hour minute second
 
-             return (LocalTime gregDay tod)
+         return (LocalTime gregDay tod)
 
 toAsciiBuilder ∷ LocalTime → AsciiBuilder
 toAsciiBuilder localTime