time 1.1.4 → 1.2
raw patch · 10 files changed
+143/−16 lines, 10 filesdep ~base
Dependency ranges changed: base
Files
- Data/Time/Calendar/Days.hs +12/−1
- Data/Time/Clock/Scale.hs +22/−2
- Data/Time/Clock/TAI.hs +14/−1
- Data/Time/Clock/UTC.hs +21/−1
- Data/Time/Format/Parse.hs +14/−2
- Data/Time/LocalTime/LocalTime.hs +21/−2
- Data/Time/LocalTime/TimeOfDay.hs +17/−4
- Data/Time/LocalTime/TimeZone.hs +12/−1
- LICENSE +1/−1
- time.cabal +9/−1
Data/Time/Calendar/Days.hs view
@@ -1,3 +1,5 @@+{-# OPTIONS -fno-warn-unused-imports #-}+#include "HsConfigure.h" -- #hide module Data.Time.Calendar.Days (@@ -7,9 +9,18 @@ import Data.Ix import Data.Typeable+#if LANGUAGE_Rank2Types+import Data.Data+#endif -- | The Modified Julian Day is a standard count of days, with zero being the day 1858-11-17.-newtype Day = ModifiedJulianDay {toModifiedJulianDay :: Integer} deriving (Eq,Ord)+newtype Day = ModifiedJulianDay {toModifiedJulianDay :: Integer} deriving (Eq,Ord+#if LANGUAGE_DeriveDataTypeable+#if LANGUAGE_Rank2Types+ ,Data+#endif+#endif+ ) instance Typeable Day where typeOf _ = mkTyConApp (mkTyCon "Data.Time.Calendar.Days.Day") []
Data/Time/Clock/Scale.hs view
@@ -1,3 +1,5 @@+{-# OPTIONS -fno-warn-unused-imports #-}+#include "HsConfigure.h" -- #hide module Data.Time.Clock.Scale (@@ -13,10 +15,19 @@ import Data.Ratio ((%)) import Data.Fixed import Data.Typeable+#if LANGUAGE_Rank2Types+import Data.Data+#endif -- | The Modified Julian Date is the day with the fraction of the day, measured from UT midnight. -- It's used to represent UT1, which is time as measured by the earth's rotation, adjusted for various wobbles.-newtype UniversalTime = ModJulianDate {getModJulianDate :: Rational} deriving (Eq,Ord)+newtype UniversalTime = ModJulianDate {getModJulianDate :: Rational} deriving (Eq,Ord+#if LANGUAGE_DeriveDataTypeable+#if LANGUAGE_Rank2Types+ ,Data+#endif+#endif+ ) instance Typeable UniversalTime where typeOf _ = mkTyConApp (mkTyCon "Data.Time.Clock.Scale.UniversalTime") []@@ -24,7 +35,16 @@ -- | This is a length of time, as measured by a clock. -- Conversion functions will treat it as seconds. -- It has a precision of 10^-12 s.-newtype DiffTime = MkDiffTime Pico deriving (Eq,Ord)+newtype DiffTime = MkDiffTime Pico deriving (Eq,Ord+#if LANGUAGE_DeriveDataTypeable+#if LANGUAGE_Rank2Types+#if HAS_DataPico+ ,Data+#else+#endif+#endif+#endif+ ) instance Typeable DiffTime where typeOf _ = mkTyConApp (mkTyCon "Data.Time.Clock.Scale.DiffTime") []
Data/Time/Clock/TAI.hs view
@@ -1,3 +1,5 @@+{-# OPTIONS -fno-warn-unused-imports #-}+#include "HsConfigure.h" -- | TAI and leap-second tables for converting to UTC: most people won't need this module. module Data.Time.Clock.TAI (@@ -18,9 +20,20 @@ import Data.Time.Clock import Data.Typeable import Data.Fixed+#if LANGUAGE_Rank2Types+import Data.Data+#endif -- | AbsoluteTime is TAI, time as measured by a clock.-newtype AbsoluteTime = MkAbsoluteTime {unAbsoluteTime :: DiffTime} deriving (Eq,Ord)+newtype AbsoluteTime = MkAbsoluteTime {unAbsoluteTime :: DiffTime} deriving (Eq,Ord+#if LANGUAGE_DeriveDataTypeable+#if LANGUAGE_Rank2Types+#if HAS_DataPico+ ,Data+#endif+#endif+#endif+ ) instance Typeable AbsoluteTime where typeOf _ = mkTyConApp (mkTyCon "Data.Time.Clock.TAI.AbsoluteTime") []
Data/Time/Clock/UTC.hs view
@@ -1,3 +1,5 @@+{-# OPTIONS -fno-warn-unused-imports #-}+#include "HsConfigure.h" -- #hide module Data.Time.Clock.UTC (@@ -17,6 +19,9 @@ import Data.Time.Clock.Scale import Data.Fixed import Data.Typeable+#if LANGUAGE_Rank2Types+import Data.Data+#endif -- | This is the simplest representation of UTC. -- It consists of the day number, and a time offset from midnight.@@ -27,6 +32,13 @@ -- | the time from midnight, 0 <= t < 86401s (because of leap-seconds) utctDayTime :: DiffTime }+#if LANGUAGE_DeriveDataTypeable+#if LANGUAGE_Rank2Types+#if HAS_DataPico+ deriving (Data)+#endif+#endif+#endif instance Typeable UTCTime where typeOf _ = mkTyConApp (mkTyCon "Data.Time.Clock.UTC.UTCTime") []@@ -45,7 +57,15 @@ -- It ignores leap-seconds, so it's not necessarily a fixed amount of clock time. -- For instance, 23:00 UTC + 2 hours of NominalDiffTime = 01:00 UTC (+ 1 day), -- regardless of whether a leap-second intervened.-newtype NominalDiffTime = MkNominalDiffTime Pico deriving (Eq,Ord)+newtype NominalDiffTime = MkNominalDiffTime Pico deriving (Eq,Ord+#if LANGUAGE_DeriveDataTypeable+#if LANGUAGE_Rank2Types+#if HAS_DataPico+ ,Data+#endif+#endif+#endif+ ) instance Typeable NominalDiffTime where typeOf _ = mkTyConApp (mkTyCon "Data.Time.Clock.UTC.NominalDiffTime") []
Data/Time/Format/Parse.hs view
@@ -1,10 +1,13 @@ {-# OPTIONS -fno-warn-orphans #-}+#include "HsConfigure.h" -- #hide module Data.Time.Format.Parse ( -- * UNIX-style parsing+#if LANGUAGE_Rank2Types parseTime, readTime, readsTime,+#endif ParseTime(..) ) where @@ -15,16 +18,20 @@ import Data.Time.Calendar.WeekDate import Data.Time.LocalTime +#if LANGUAGE_Rank2Types import Control.Monad+#endif import Data.Char import Data.Fixed import Data.List import Data.Maybe import Data.Ratio import System.Locale+#if LANGUAGE_Rank2Types import Text.ParserCombinators.ReadP hiding (char, string)-+#endif +#if LANGUAGE_Rank2Types -- | Case-insensitive version of 'Text.ParserCombinators.ReadP.char'. char :: Char -> ReadP Char char c = satisfy (\x -> toUpper c == toUpper x)@@ -33,8 +40,9 @@ string this = do s <- look; scan this s where scan [] _ = do return this- scan (x:xs) (y:ys) | toUpper x == toUpper y = do get; scan xs ys+ scan (x:xs) (y:ys) | toUpper x == toUpper y = do _ <- get; scan xs ys scan _ _ = do pfail+#endif -- | Convert string to upper case. up :: String -> String up = map toUpper@@ -52,6 +60,7 @@ -- corresponding part of the input. -> t +#if LANGUAGE_Rank2Types -- | Parses a time value given a format string. Supports the same %-codes as -- 'formatTime'. Leading and trailing whitespace is accepted. Case is not -- significant. Some variations in the input are accepted:@@ -179,6 +188,7 @@ optional (char ':') m <- digits 2 return (s:h++m)+#endif -- -- * Instances for the time package types@@ -319,6 +329,7 @@ -- * Read instances for time package types +#if LANGUAGE_Rank2Types instance Read Day where readsPrec _ = readParen False $ readsTime defaultTimeLocale "%Y-%m-%d" @@ -337,6 +348,7 @@ instance Read UTCTime where readsPrec n s = [ (zonedTimeToUTC t, r) | (t,r) <- readsPrec n s ]+#endif readTzOffset :: String -> Int readTzOffset str =
Data/Time/LocalTime/LocalTime.hs view
@@ -1,4 +1,5 @@-{-# OPTIONS -fno-warn-orphans #-}+{-# OPTIONS -fno-warn-orphans -fno-warn-unused-imports #-}+#include "HsConfigure.h" -- #hide module Data.Time.LocalTime.LocalTime@@ -17,6 +18,9 @@ import Data.Time.Calendar import Data.Time.Clock import Data.Typeable+#if LANGUAGE_Rank2Types+import Data.Data+#endif -- | A simple day and time aggregate, where the day is of the specified parameter, -- and the time is a TimeOfDay.@@ -25,7 +29,15 @@ data LocalTime = LocalTime { localDay :: Day, localTimeOfDay :: TimeOfDay-} deriving (Eq,Ord)+} deriving (Eq,Ord+#if LANGUAGE_DeriveDataTypeable+#if LANGUAGE_Rank2Types+#if HAS_DataPico+ ,Data+#endif+#endif+#endif+ ) instance Typeable LocalTime where typeOf _ = mkTyConApp (mkTyCon "Data.Time.LocalTime.LocalTime.LocalTime") []@@ -59,6 +71,13 @@ zonedTimeToLocalTime :: LocalTime, zonedTimeZone :: TimeZone }+#if LANGUAGE_DeriveDataTypeable+#if LANGUAGE_Rank2Types+#if HAS_DataPico+ deriving (Data)+#endif+#endif+#endif instance Typeable ZonedTime where typeOf _ = mkTyConApp (mkTyCon "Data.Time.LocalTime.LocalTime.ZonedTime") []
Data/Time/LocalTime/TimeOfDay.hs view
@@ -1,3 +1,5 @@+{-# OPTIONS -fno-warn-unused-imports #-}+#include "HsConfigure.h" -- #hide module Data.Time.LocalTime.TimeOfDay (@@ -13,6 +15,9 @@ import Data.Time.Clock import Data.Typeable import Data.Fixed+#if LANGUAGE_Rank2Types+import Data.Data+#endif -- | Time of day as represented in hour, minute and second (with picoseconds), typically used to express local time of day. data TimeOfDay = TimeOfDay {@@ -23,7 +28,15 @@ -- | Note that 0 <= todSec < 61, accomodating leap seconds. -- Any local minute may have a leap second, since leap seconds happen in all zones simultaneously todSec :: Pico-} deriving (Eq,Ord)+} deriving (Eq,Ord+#if LANGUAGE_DeriveDataTypeable+#if LANGUAGE_Rank2Types+#if HAS_DataPico+ ,Data+#endif+#endif+#endif+ ) instance Typeable TimeOfDay where typeOf _ = mkTyConApp (mkTyCon "Data.Time.LocalTime.TimeOfDay.TimeOfDay") []@@ -41,9 +54,9 @@ makeTimeOfDayValid :: Int -> Int -> Pico -> Maybe TimeOfDay makeTimeOfDayValid h m s = do- clipValid 0 23 h- clipValid 0 59 m- clipValid 0 60.999999999999 s+ _ <- clipValid 0 23 h+ _ <- clipValid 0 59 m+ _ <- clipValid 0 60.999999999999 s return (TimeOfDay h m s) -- | Convert a ToD in UTC to a ToD in some timezone, together with a day adjustment.
Data/Time/LocalTime/TimeZone.hs view
@@ -1,4 +1,6 @@+{-# OPTIONS -fno-warn-unused-imports #-} {-# LANGUAGE ForeignFunctionInterface #-}+#include "HsConfigure.h" -- #hide module Data.Time.LocalTime.TimeZone@@ -18,6 +20,9 @@ import Foreign import Foreign.C import Data.Typeable+#if LANGUAGE_Rank2Types+import Data.Data+#endif -- | A TimeZone is a whole number of minutes offset from UTC, together with a name and a \"just for summer\" flag. data TimeZone = TimeZone {@@ -27,7 +32,13 @@ timeZoneSummerOnly :: Bool, -- | The name of the zone, typically a three- or four-letter acronym. timeZoneName :: String-} deriving (Eq,Ord)+} deriving (Eq,Ord+#if LANGUAGE_DeriveDataTypeable+#if LANGUAGE_Rank2Types+ ,Data+#endif+#endif+ ) instance Typeable TimeZone where typeOf _ = mkTyConApp (mkTyCon "Data.Time.LocalTime.TimeZone.TimeZone") []
LICENSE view
@@ -1,4 +1,4 @@-TimeLib is Copyright (c) Ashley Yakeley, 2004-2007.+TimeLib is Copyright (c) Ashley Yakeley, 2004-2010. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
time.cabal view
@@ -1,5 +1,5 @@ name: time-version: 1.1.4+version: 1.2 stability: stable license: BSD3 license-file: LICENSE@@ -28,6 +28,14 @@ library { build-depends: base == 4.*, old-locale+ ghc-options: -Wall+ if impl(ghc)+ extensions: Rank2Types DeriveDataTypeable StandaloneDeriving+ cpp-options: -DLANGUAGE_Rank2Types -DLANGUAGE_DeriveDataTypeable -DLANGUAGE_StandaloneDeriving+ else+ if impl(hugs)+ extensions: Rank2Types+ cpp-options: -DLANGUAGE_Rank2Types if os(windows) build-depends: Win32 exposed-modules: