[commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: more sensible identifer names (acc1fc8)

git at git.haskell.org git at git.haskell.org
Fri Apr 21 16:46:12 UTC 2017


Repository : ssh://git@git.haskell.org/time

On branches: format-widths,ghc,improve-leapseconds,master,posix-perf,tasty,wip/travis
Link       : http://git.haskell.org/packages/time.git/commitdiff/acc1fc8124f9dbdb740c76a543421ba47ab1d456

>---------------------------------------------------------------

commit acc1fc8124f9dbdb740c76a543421ba47ab1d456
Author: Ashley Yakeley <ashley at semantic.org>
Date:   Sat Nov 12 17:45:46 2005 -0800

    more sensible identifer names
    
    darcs-hash:20051113014546-ac6dd-27e3b85dc58a1c0cef8b1611e17415887cc4ecc8


>---------------------------------------------------------------

acc1fc8124f9dbdb740c76a543421ba47ab1d456
 Data/Time/LocalTime/Format.hs    |  4 ++--
 Data/Time/LocalTime/LocalTime.hs | 16 ++++++++--------
 test/CurrentTime.hs              |  4 ++--
 test/ShowDST.hs                  |  2 +-
 test/TestFormat.hs               |  2 +-
 5 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/Data/Time/LocalTime/Format.hs b/Data/Time/LocalTime/Format.hs
index 3976658..ccb72e9 100644
--- a/Data/Time/LocalTime/Format.hs
+++ b/Data/Time/LocalTime/Format.hs
@@ -66,7 +66,7 @@ instance FormatTime TimeOfDay where
 	formatCharacter _   = Nothing
 
 instance FormatTime ZonedTime where
-	formatCharacter 's' = Just (\_ zt -> show (truncate (utcTimeToPOSIXSeconds (ztUTC zt)) :: Integer))
+	formatCharacter 's' = Just (\_ zt -> show (truncate (utcTimeToPOSIXSeconds (zonedTimeToUTC zt)) :: Integer))
 	formatCharacter c = case (formatCharacter c) of
 		Just f -> Just (\locale dt -> f locale (ztLocalTime dt))
 		Nothing -> case (formatCharacter c) of
@@ -116,4 +116,4 @@ instance FormatTime Day where
 	formatCharacter _   = Nothing
 
 instance FormatTime UTCTime where
-	formatCharacter c = fmap (\f locale t -> f locale (zonedTimeFromUTC utc t)) (formatCharacter c)
+	formatCharacter c = fmap (\f locale t -> f locale (utcToZonedTime utc t)) (formatCharacter c)
diff --git a/Data/Time/LocalTime/LocalTime.hs b/Data/Time/LocalTime/LocalTime.hs
index 1ac0f1f..6cb0d49 100644
--- a/Data/Time/LocalTime/LocalTime.hs
+++ b/Data/Time/LocalTime/LocalTime.hs
@@ -9,7 +9,7 @@ module Data.Time.LocalTime.LocalTime
 	-- converting UTC and UT1 times to LocalTime
 	utcToLocalTime,localTimeToUTC,ut1ToLocalTime,localTimeToUT1,
 	
-	ZonedTime(..),zonedTimeFromUTC,ztUTC,getZonedTime,utcToLocalZonedTime
+	ZonedTime(..),utcToZonedTime,zonedTimeToUTC,getZonedTime,utcToLocalZonedTime
 ) where
 
 import Data.Time.LocalTime.TimeOfDay
@@ -56,26 +56,26 @@ data ZonedTime = ZonedTime {
 	ztZone :: TimeZone
 }
 
-zonedTimeFromUTC :: TimeZone -> UTCTime -> ZonedTime
-zonedTimeFromUTC zone time = ZonedTime (utcToLocalTime zone time) zone
+utcToZonedTime :: TimeZone -> UTCTime -> ZonedTime
+utcToZonedTime zone time = ZonedTime (utcToLocalTime zone time) zone
 
-ztUTC :: ZonedTime -> UTCTime
-ztUTC (ZonedTime t zone) = localTimeToUTC zone t
+zonedTimeToUTC :: ZonedTime -> UTCTime
+zonedTimeToUTC (ZonedTime t zone) = localTimeToUTC zone t
 
 instance Show ZonedTime where
 	show (ZonedTime t zone) = show t ++ " " ++ show zone
 
 instance Show UTCTime where
-	show t = show (zonedTimeFromUTC utc t)
+	show t = show (utcToZonedTime utc t)
 
 getZonedTime :: IO ZonedTime
 getZonedTime = do
 	t <- getCurrentTime
 	zone <- getTimeZone t
-	return (zonedTimeFromUTC zone t)
+	return (utcToZonedTime zone t)
 
 -- |
 utcToLocalZonedTime :: UTCTime -> IO ZonedTime
 utcToLocalZonedTime t = do
 	zone <- getTimeZone t
-	return (zonedTimeFromUTC zone t)
+	return (utcToZonedTime zone t)
diff --git a/test/CurrentTime.hs b/test/CurrentTime.hs
index b0970f0..464e643 100644
--- a/test/CurrentTime.hs
+++ b/test/CurrentTime.hs
@@ -8,6 +8,6 @@ main :: IO ()
 main = do
 	now <- getCurrentTime
 	putStrLn (show (utctDay now) ++ "," ++ show (utctDayTime now))
-	putStrLn (show (zonedTimeFromUTC utc now :: ZonedTime))
+	putStrLn (show (utcToZonedTime utc now :: ZonedTime))
 	myzone <- getCurrentTimeZone
-	putStrLn (show (zonedTimeFromUTC myzone now :: ZonedTime))
+	putStrLn (show (utcToZonedTime myzone now :: ZonedTime))
diff --git a/test/ShowDST.hs b/test/ShowDST.hs
index ed1a92f..fa7dbda 100644
--- a/test/ShowDST.hs
+++ b/test/ShowDST.hs
@@ -20,7 +20,7 @@ findTransition a b = do
 			return (tp ++ tq)
 
 showZoneTime :: TimeZone -> UTCTime -> String
-showZoneTime zone time = show (zonedTimeFromUTC zone time)
+showZoneTime zone time = show (utcToZonedTime zone time)
 
 showTransition :: (UTCTime,TimeZone,TimeZone) -> String
 showTransition (time,zone1,zone2) = (showZoneTime zone1 time) ++ " => " ++ (showZoneTime zone2 time)
diff --git a/test/TestFormat.hs b/test/TestFormat.hs
index b4d1e70..1529dee 100644
--- a/test/TestFormat.hs
+++ b/test/TestFormat.hs
@@ -67,7 +67,7 @@ times = [baseTime0] ++ (fmap getDay [0..23]) ++ (fmap getDay [0..100]) ++
 
 compareFormat :: String -> TimeZone -> UTCTime -> IO ()
 compareFormat fmt zone time = let
-		ctime = zonedTimeFromUTC zone time
+		ctime = utcToZonedTime zone time
 		haskellText = formatTime locale fmt ctime
 	in do
 		unixText <- unixFormatTime fmt zone time



More information about the ghc-commits mailing list