[commit: packages/time] master, wip/travis: Ensure Read/Show instances are always provided with UTCTime and Universal (34c255e)
git at git.haskell.org
git at git.haskell.org
Sat May 7 06:50:05 UTC 2016
Repository : ssh://git@git.haskell.org/time
On branches: master,wip/travis
Link : http://git.haskell.org/packages/time.git/commitdiff/34c255e0bfb1659d09785eaefcfd781549ff99ed
>---------------------------------------------------------------
commit 34c255e0bfb1659d09785eaefcfd781549ff99ed
Author: U-CIQDEV\gbazerman <gbazerman at GBAZERMAN-T35.ciqdev.com>
Date: Wed Mar 11 15:43:45 2015 -0400
Ensure Read/Show instances are always provided with UTCTime and Universal
>---------------------------------------------------------------
34c255e0bfb1659d09785eaefcfd781549ff99ed
lib/Data/Time/Clock.hs | 9 +++------
lib/Data/Time/Clock/POSIX.hs | 6 +++++-
lib/Data/Time/Clock/Scale.hs | 6 ------
lib/Data/Time/Clock/UTC.hs | 6 ------
lib/Data/Time/Format/Parse.hs | 3 ++-
lib/Data/Time/LocalTime/LocalTime.hs | 7 ++++++-
lib/Data/Time/LocalTime/TimeOfDay.hs | 2 +-
lib/Data/Time/LocalTime/TimeZone.hs | 2 +-
8 files changed, 18 insertions(+), 23 deletions(-)
diff --git a/lib/Data/Time/Clock.hs b/lib/Data/Time/Clock.hs
index e1d1088..b03e272 100644
--- a/lib/Data/Time/Clock.hs
+++ b/lib/Data/Time/Clock.hs
@@ -4,15 +4,12 @@ module Data.Time.Clock
module Data.Time.Clock.Scale,
module Data.Time.Clock.UTC,
module Data.Time.Clock.UTCDiff,
- module Data.Time.Clock
+ getCurrentTime
) where
import Data.Time.Clock.Scale
import Data.Time.Clock.UTCDiff
import Data.Time.Clock.UTC
import Data.Time.Clock.POSIX
-import Control.Monad
-
--- | Get the current UTC time from the system clock.
-getCurrentTime :: IO UTCTime
-getCurrentTime = liftM posixSecondsToUTCTime getPOSIXTime
+import Data.Time.Format.Parse()
+import Data.Time.LocalTime()
diff --git a/lib/Data/Time/Clock/POSIX.hs b/lib/Data/Time/Clock/POSIX.hs
index 07411c5..91f22e0 100644
--- a/lib/Data/Time/Clock/POSIX.hs
+++ b/lib/Data/Time/Clock/POSIX.hs
@@ -2,7 +2,7 @@
-- Most people won't need this module.
module Data.Time.Clock.POSIX
(
- posixDayLength,POSIXTime,posixSecondsToUTCTime,utcTimeToPOSIXSeconds,getPOSIXTime
+ posixDayLength,POSIXTime,posixSecondsToUTCTime,utcTimeToPOSIXSeconds,getPOSIXTime,getCurrentTime
) where
import Data.Time.Clock.UTC
@@ -64,3 +64,7 @@ ctimevalToPosixSeconds (MkCTimeval s mus) = (fromIntegral s) + (fromIntegral mus
getPOSIXTime = liftM ctimevalToPosixSeconds getCTimeval
#endif
+
+-- | Get the current UTC time from the system clock.
+getCurrentTime :: IO UTCTime
+getCurrentTime = liftM posixSecondsToUTCTime getPOSIXTime
diff --git a/lib/Data/Time/Clock/Scale.hs b/lib/Data/Time/Clock/Scale.hs
index 8700e32..5838b4d 100644
--- a/lib/Data/Time/Clock/Scale.hs
+++ b/lib/Data/Time/Clock/Scale.hs
@@ -23,12 +23,6 @@ import Data.Data
-- | 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.
---
--- For the 'Read' instance of 'UniversalTime',
--- import "Data.Time" or "Data.Time.Format".
---
--- For the 'Show' instance of 'UniversalTime',
--- import "Data.Time" or "Data.Time.LocalTime".
newtype UniversalTime = ModJulianDate {getModJulianDate :: Rational} deriving (Eq,Ord
#if LANGUAGE_DeriveDataTypeable
#if LANGUAGE_Rank2Types
diff --git a/lib/Data/Time/Clock/UTC.hs b/lib/Data/Time/Clock/UTC.hs
index 63783e2..eff7f4d 100644
--- a/lib/Data/Time/Clock/UTC.hs
+++ b/lib/Data/Time/Clock/UTC.hs
@@ -28,12 +28,6 @@ import Data.Data
-- | This is the simplest representation of UTC.
-- It consists of the day number, and a time offset from midnight.
-- Note that if a day has a leap second added to it, it will have 86401 seconds.
---
--- For the 'Read' instance of 'UTCTime',
--- import "Data.Time" or "Data.Time.Format".
---
--- For the 'Show' instance of 'UTCTime',
--- import "Data.Time" or "Data.Time.LocalTime".
data UTCTime = UTCTime {
-- | the day
utctDay :: Day,
diff --git a/lib/Data/Time/Format/Parse.hs b/lib/Data/Time/Format/Parse.hs
index 0bd698d..dda7e8f 100644
--- a/lib/Data/Time/Format/Parse.hs
+++ b/lib/Data/Time/Format/Parse.hs
@@ -15,7 +15,8 @@ module Data.Time.Format.Parse
) where
import Data.Time.Clock.POSIX
-import Data.Time.Clock
+import Data.Time.Clock.Scale
+import Data.Time.Clock.UTC
import Data.Time.Calendar
import Data.Time.Calendar.OrdinalDate
import Data.Time.Calendar.WeekDate
diff --git a/lib/Data/Time/LocalTime/LocalTime.hs b/lib/Data/Time/LocalTime/LocalTime.hs
index 360a2c6..1c47f53 100644
--- a/lib/Data/Time/LocalTime/LocalTime.hs
+++ b/lib/Data/Time/LocalTime/LocalTime.hs
@@ -16,7 +16,12 @@ module Data.Time.LocalTime.LocalTime
import Data.Time.LocalTime.TimeOfDay
import Data.Time.LocalTime.TimeZone
import Data.Time.Calendar
-import Data.Time.Clock
+
+import Data.Time.Clock.Scale
+import Data.Time.Clock.UTCDiff
+import Data.Time.Clock.UTC
+import Data.Time.Clock.POSIX
+
import Control.DeepSeq
import Data.Typeable
#if LANGUAGE_Rank2Types
diff --git a/lib/Data/Time/LocalTime/TimeOfDay.hs b/lib/Data/Time/LocalTime/TimeOfDay.hs
index 8e6e7cc..30e03c9 100644
--- a/lib/Data/Time/LocalTime/TimeOfDay.hs
+++ b/lib/Data/Time/LocalTime/TimeOfDay.hs
@@ -12,7 +12,7 @@ module Data.Time.LocalTime.TimeOfDay
import Data.Time.LocalTime.TimeZone
import Data.Time.Calendar.Private
-import Data.Time.Clock
+import Data.Time.Clock.Scale
import Control.DeepSeq
import Data.Typeable
import Data.Fixed
diff --git a/lib/Data/Time/LocalTime/TimeZone.hs b/lib/Data/Time/LocalTime/TimeZone.hs
index 6c2f39b..177d115 100644
--- a/lib/Data/Time/LocalTime/TimeZone.hs
+++ b/lib/Data/Time/LocalTime/TimeZone.hs
@@ -14,8 +14,8 @@ module Data.Time.LocalTime.TimeZone
--import System.Time.Calendar.Format
import Data.Time.Calendar.Private
-import Data.Time.Clock
import Data.Time.Clock.POSIX
+import Data.Time.Clock.UTC
#if __GLASGOW_HASKELL__ >= 709
import Foreign
More information about the ghc-commits
mailing list