packages feed

time 1.9 → 1.9.1

raw patch · 17 files changed

+42/−142 lines, 17 files

Files

changelog.md view
@@ -1,5 +1,9 @@ # Change Log +## [1.9.1]+- new functions secondsToNominalDiffTime & nominalDiffTimeToSeconds+- expose FormatTime and ParseTime in Data.Time.Format.Internal+ ## [1.9] - new conversion functions timeToDaysAndTimeOfDay & daysAndTimeOfDayToTime - new DayOfWeek type
configure.ac view
@@ -1,4 +1,4 @@-AC_INIT([Haskell time package], [1.9], [ashley@semantic.org], [time])+AC_INIT([Haskell time package], [1.9.1], [ashley@semantic.org], [time])  # Safety check: Ensure that we are in the correct source directory. AC_CONFIG_SRCDIR([lib/include/HsTime.h])
lib/Data/Time/Calendar/Days.hs view
@@ -1,5 +1,4 @@ {-# OPTIONS -fno-warn-unused-imports #-}-#include "HsConfigure.h" module Data.Time.Calendar.Days (     -- * Days@@ -9,18 +8,10 @@ import Control.DeepSeq 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-#if LANGUAGE_DeriveDataTypeable-#if LANGUAGE_Rank2Types-    ,Data, Typeable-#endif-#endif-    )+newtype Day = ModifiedJulianDay {toModifiedJulianDay :: Integer} deriving (Eq,Ord,Data, Typeable)  instance NFData Day where     rnf (ModifiedJulianDay a) = rnf a
lib/Data/Time/Clock/Internal/AbsoluteTime.hs view
@@ -1,5 +1,3 @@--- {-# OPTIONS -fno-warn-unused-imports #-}-#include "HsConfigure.h" -- | TAI and leap-second maps for converting to UTC: most people won't need this module. module Data.Time.Clock.Internal.AbsoluteTime (@@ -9,24 +7,14 @@ ) where  import Data.Typeable-#if LANGUAGE_Rank2Types import Data.Data-#endif import Control.DeepSeq import Data.Time.Calendar.Days import Data.Time.Clock.Internal.DiffTime   -- | AbsoluteTime is TAI, time as measured by a clock.-newtype AbsoluteTime = MkAbsoluteTime DiffTime deriving (Eq,Ord-#if LANGUAGE_DeriveDataTypeable-#if LANGUAGE_Rank2Types-#if HAS_DataPico-    ,Data, Typeable-#endif-#endif-#endif-    )+newtype AbsoluteTime = MkAbsoluteTime DiffTime deriving (Eq,Ord,Data,Typeable)  instance NFData AbsoluteTime where     rnf (MkAbsoluteTime a) = rnf a
lib/Data/Time/Clock/Internal/CTimeval.hs view
@@ -3,7 +3,7 @@ #ifndef mingw32_HOST_OS -- All Unix-specific, this -#if __GLASGOW_HASKELL__ >= 709 || __GLASGOW_HASKELL__ < 702+#if __GLASGOW_HASKELL__ >= 709 import Foreign #else import Foreign.Safe
lib/Data/Time/Clock/Internal/DiffTime.hs view
@@ -1,8 +1,5 @@-#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-}-#endif {-# OPTIONS -fno-warn-unused-imports #-}-#include "HsConfigure.h" module Data.Time.Clock.Internal.DiffTime     (     -- * Absolute intervals@@ -13,9 +10,7 @@     ) where  import Data.Typeable-#if LANGUAGE_Rank2Types import Data.Data-#endif import Data.Ratio ((%)) import Data.Fixed import Control.DeepSeq@@ -24,16 +19,7 @@ -- | 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-#if LANGUAGE_DeriveDataTypeable-#if LANGUAGE_Rank2Types-#if HAS_DataPico-    ,Data, Typeable-#else-#endif-#endif-#endif-    )+newtype DiffTime = MkDiffTime Pico deriving (Eq,Ord,Data, Typeable)  -- necessary because H98 doesn't have "cunning newtype" derivation instance NFData DiffTime where -- FIXME: Data.Fixed had no NFData instances yet at time of writing
lib/Data/Time/Clock/Internal/NominalDiffTime.hs view
@@ -1,18 +1,15 @@ {-# OPTIONS -fno-warn-unused-imports #-}-#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-}-#endif-#include "HsConfigure.h" module Data.Time.Clock.Internal.NominalDiffTime     (     NominalDiffTime,+    secondsToNominalDiffTime,+    nominalDiffTimeToSeconds,     nominalDay,     ) where  import Data.Typeable-#if LANGUAGE_Rank2Types import Data.Data-#endif import Data.Fixed import Data.Time.Calendar.Days import Control.DeepSeq@@ -24,15 +21,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-#if LANGUAGE_DeriveDataTypeable-#if LANGUAGE_Rank2Types-#if HAS_DataPico-    ,Data, Typeable-#endif-#endif-#endif-    )+newtype NominalDiffTime = MkNominalDiffTime Pico deriving (Eq,Ord,Data,Typeable)++-- | Create a 'NominalDiffTime' from a number of seconds.+secondsToNominalDiffTime :: Pico -> NominalDiffTime+secondsToNominalDiffTime = MkNominalDiffTime++-- | Get the seconds in a 'NominalDiffTime'.+nominalDiffTimeToSeconds :: NominalDiffTime -> Pico+nominalDiffTimeToSeconds (MkNominalDiffTime t) = t  -- necessary because H98 doesn't have "cunning newtype" derivation instance NFData NominalDiffTime where -- FIXME: Data.Fixed had no NFData instances yet at time of writing
lib/Data/Time/Clock/Internal/UTCTime.hs view
@@ -1,4 +1,3 @@-#include "HsConfigure.h" module Data.Time.Clock.Internal.UTCTime (     -- * UTC@@ -14,9 +13,7 @@ ) where  import Data.Typeable-#if LANGUAGE_Rank2Types import Data.Data-#endif import Control.DeepSeq import Data.Time.Calendar.Days import Data.Time.Clock.Internal.DiffTime@@ -30,14 +27,7 @@     utctDay :: Day,     -- | the time from midnight, 0 <= t < 86401s (because of leap-seconds)     utctDayTime :: DiffTime-}-#if LANGUAGE_DeriveDataTypeable-#if LANGUAGE_Rank2Types-#if HAS_DataPico-    deriving (Data, Typeable)-#endif-#endif-#endif+} deriving (Data, Typeable)  instance NFData UTCTime where     rnf (UTCTime d t) = rnf d `seq` rnf t `seq` ()
lib/Data/Time/Clock/Internal/UniversalTime.hs view
@@ -1,4 +1,3 @@-#include "HsConfigure.h" module Data.Time.Clock.Internal.UniversalTime     (     -- * Universal Time@@ -7,21 +6,13 @@     ) where  import Data.Typeable-#if LANGUAGE_Rank2Types import Data.Data-#endif import Control.DeepSeq   -- | 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-#if LANGUAGE_DeriveDataTypeable-#if LANGUAGE_Rank2Types-    ,Data, Typeable-#endif-#endif-    )+newtype UniversalTime = ModJulianDate {getModJulianDate :: Rational} deriving (Eq,Ord,Data, Typeable)  -- necessary because H98 doesn't have "cunning newtype" derivation instance NFData UniversalTime where
lib/Data/Time/Clock/TAI.hs view
@@ -1,5 +1,4 @@ {-# OPTIONS -fno-warn-orphans #-}-#include "HsConfigure.h" -- | TAI and leap-second maps for converting to UTC: most people won't need this module. module Data.Time.Clock.TAI (
+ lib/Data/Time/Format/Internal.hs view
@@ -0,0 +1,8 @@+{-|+The contents of this module is liable to change, or disappear entirely.+Please <https://github.com/haskell/time/issues/new let me know> if you depend on anything here.+-}+module Data.Time.Format.Internal (FormatTime(..),ParseTime(..)) where++import Data.Time.Format.Format.Class+import Data.Time.Format.Parse.Class
lib/Data/Time/LocalTime/Internal/LocalTime.hs view
@@ -1,5 +1,4 @@ {-# OPTIONS -fno-warn-orphans #-}-#include "HsConfigure.h" module Data.Time.LocalTime.Internal.LocalTime (     -- * Local Time@@ -15,9 +14,7 @@  import Control.DeepSeq import Data.Typeable-#if LANGUAGE_Rank2Types import Data.Data-#endif import Data.Time.Calendar.Days import Data.Time.Calendar.Gregorian import Data.Time.Clock.Internal.NominalDiffTime@@ -35,15 +32,7 @@ data LocalTime = LocalTime {     localDay    :: Day,     localTimeOfDay   :: TimeOfDay-} deriving (Eq,Ord-#if LANGUAGE_DeriveDataTypeable-#if LANGUAGE_Rank2Types-#if HAS_DataPico-    ,Data, Typeable-#endif-#endif-#endif-    )+} deriving (Eq,Ord,Data, Typeable)  instance NFData LocalTime where     rnf (LocalTime d t) = rnf d `seq` rnf t `seq` ()
lib/Data/Time/LocalTime/Internal/TimeOfDay.hs view
@@ -1,5 +1,4 @@ {-# OPTIONS -fno-warn-unused-imports #-}-#include "HsConfigure.h" module Data.Time.LocalTime.Internal.TimeOfDay (     -- * Time of day@@ -13,9 +12,7 @@ import Control.DeepSeq import Data.Typeable import Data.Fixed-#if LANGUAGE_Rank2Types import Data.Data-#endif import Data.Time.Clock.Internal.DiffTime import Data.Time.Clock.Internal.NominalDiffTime import Data.Time.Calendar.Private@@ -31,15 +28,7 @@     -- | 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-#if LANGUAGE_DeriveDataTypeable-#if LANGUAGE_Rank2Types-#if HAS_DataPico-    ,Data, Typeable-#endif-#endif-#endif-    )+} deriving (Eq,Ord,Data, Typeable)  instance NFData TimeOfDay where     rnf (TimeOfDay h m s) = rnf h `seq` rnf m `seq` s `seq` () -- FIXME: Data.Fixed had no NFData instances yet at time of writing
lib/Data/Time/LocalTime/Internal/TimeZone.hs view
@@ -1,6 +1,5 @@ {-# OPTIONS -fno-warn-unused-imports #-} {-# LANGUAGE ForeignFunctionInterface #-}-#include "HsConfigure.h" module Data.Time.LocalTime.Internal.TimeZone (     -- * Time zones@@ -16,7 +15,7 @@ import Data.Time.Clock.POSIX import Data.Time.Clock.Internal.UTCTime -#if __GLASGOW_HASKELL__ >= 709 || __GLASGOW_HASKELL__ < 702+#if __GLASGOW_HASKELL__ >= 709 import Foreign #else import Foreign.Safe@@ -24,9 +23,7 @@ import Foreign.C import Control.DeepSeq 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 {@@ -36,13 +33,7 @@     timeZoneSummerOnly :: Bool,     -- | The name of the zone, typically a three- or four-letter acronym.     timeZoneName :: String-} deriving (Eq,Ord-#if LANGUAGE_DeriveDataTypeable-#if LANGUAGE_Rank2Types-    ,Data, Typeable-#endif-#endif-    )+} deriving (Eq,Ord,Data, Typeable)  instance NFData TimeZone where     rnf (TimeZone m so n) = rnf m `seq` rnf so `seq` rnf n `seq` ()
lib/Data/Time/LocalTime/Internal/ZonedTime.hs view
@@ -1,5 +1,4 @@ {-# OPTIONS -fno-warn-orphans #-}-#include "HsConfigure.h" module Data.Time.LocalTime.Internal.ZonedTime (     ZonedTime(..),utcToZonedTime,zonedTimeToUTC,getZonedTime,utcToLocalZonedTime@@ -7,10 +6,7 @@  import Control.DeepSeq import Data.Typeable-#if LANGUAGE_Rank2Types import Data.Data-#endif- import Data.Time.Clock.Internal.UTCTime import Data.Time.Clock.POSIX import Data.Time.LocalTime.Internal.TimeZone@@ -22,13 +18,7 @@     zonedTimeToLocalTime :: LocalTime,     zonedTimeZone :: TimeZone }-#if LANGUAGE_DeriveDataTypeable-#if LANGUAGE_Rank2Types-#if HAS_DataPico     deriving (Data, Typeable)-#endif-#endif-#endif  instance NFData ZonedTime where     rnf (ZonedTime lt z) = rnf lt `seq` rnf z `seq` ()
− lib/include/HsConfigure.h
@@ -1,7 +0,0 @@-#define HAS_DataPico 0-#if LANGUAGE_Rank2Types-#if MIN_VERSION_base(4,2,0)-#undef HAS_DataPico-#define HAS_DataPico 1-#endif-#endif
time.cabal view
@@ -1,5 +1,5 @@ name:           time-version:        1.9+version:        1.9.1 stability:      stable license:        BSD3 license-file:   LICENSE@@ -20,7 +20,6 @@     aclocal.m4     configure.ac     configure-    lib/include/HsConfigure.h     lib/include/HsTime.h     lib/include/HsTimeConfig.h.in     test/unix/Test/Format/*.c@@ -38,17 +37,13 @@ library     hs-source-dirs: lib     default-language: Haskell2010-    if impl(ghc)-        default-extensions:-            Rank2Types-            DeriveDataTypeable-            StandaloneDeriving-        cpp-options: -DLANGUAGE_Rank2Types -DLANGUAGE_DeriveDataTypeable -DLANGUAGE_StandaloneDeriving-    else-        if impl(hugs)-            default-extensions: Rank2Types-            cpp-options: -DLANGUAGE_Rank2Types+    default-extensions:+        Rank2Types+        DeriveDataTypeable+        StandaloneDeriving+        CPP     ghc-options: -Wall -fwarn-tabs+    c-sources: lib/cbits/HsTime.c     build-depends:         base >= 4.7 && < 5,         deepseq >= 1.1@@ -67,10 +62,9 @@         Data.Time.Clock.TAI,         Data.Time.LocalTime,         Data.Time.Format,+        Data.Time.Format.Internal,         Data.Time.Format.ISO8601,         Data.Time-    default-extensions:    CPP-    c-sources: lib/cbits/HsTime.c     other-modules:         Data.Format         Data.Time.Calendar.Private,