packages feed

xsd 0.3.0 → 0.3.1

raw patch · 3 files changed

+26/−2 lines, 3 files

Files

+ Text/XML/XSD.hs view
@@ -0,0 +1,5 @@+module Text.XML.XSD(+                     module Text.XML.XSD.DateTime+                   ) where++import Text.XML.XSD.DateTime
Text/XML/XSD/DateTime.hs view
@@ -4,9 +4,11 @@                               dateTime',                               dateTime,                               toZonedTime,+                              fromZonedTime,                               zonedTime',                               zonedTime,                               toUTCTime,+                              fromUTCTime,                               utcTime',                               utcTime                             ) where@@ -51,6 +53,14 @@     LocalTime (fromGregorian (fromIntegral ((if neg then negate else id) yy)) mm dd) (     TimeOfDay hhh mmm (realToFrac (read (show sss ++ seconds ssss) :: Double)))) (timeZone tz) +-- | Converts a zoned time to a @dateTime@.+fromZonedTime :: ZonedTime -> DateTime+fromZonedTime (ZonedTime (LocalTime d (TimeOfDay hhh mmm sss)) (TimeZone m _ _)) =+  let (yy, mm, dd) = toGregorian d+      (sss1, sss2) = properFraction sss+      (hz, mz) = m `quotRem` 60+  in DateTime (yy < 0) (abs (fromIntegral yy)) mm dd hhh mmm sss1 (Just (show sss2)) (Offset False (Just (hz < 0)) (Just hz) (Just mz))+ -- | Parses the string in a @dateTime@ then converts to a zoned time and may fail with a parse error. zonedTime' :: String -> Either ParseError ZonedTime zonedTime' = fmap toZonedTime . dateTime'@@ -62,6 +72,14 @@ -- | Converts a @dateTime@ to a UTC time. toUTCTime :: DateTime -> UTCTime toUTCTime = uncurry localTimeToUTC . (zonedTimeZone &&& zonedTimeToLocalTime) . toZonedTime++-- | Converts a UTC time to a @dateTime@.+fromUTCTime :: UTCTime -> DateTime+fromUTCTime (UTCTime d t) =+  let (yy, mm, dd) = toGregorian d+      TimeOfDay hhh mmm sss = timeToTimeOfDay t+      (sss1, sss2) = properFraction sss+  in DateTime (yy < 0) (abs (fromIntegral yy)) mm dd hhh mmm sss1 (Just (show sss2)) (Offset True Nothing Nothing Nothing)  -- | Parses the string in a @dateTime@ then converts to a UTC time and may fail with a parse error. utcTime' :: String -> Either ParseError UTCTime
xsd.cabal view
@@ -1,5 +1,5 @@ Name:                xsd-Version:             0.3.0+Version:             0.3.1 License:             BSD3 License-File:        LICENSE Synopsis:            XML Schema data structures@@ -22,4 +22,5 @@     Build-Depends: base < 3, parsec, time    GHC-Options:    -Wall-  Exposed-Modules: Text.XML.XSD.DateTime+  Exposed-Modules: Text.XML.XSD+                   Text.XML.XSD.DateTime