[commit: packages/time] format-widths, ghc, master, tasty: rename unixEpochDay to systemEpochDay (a634d25)
git at git.haskell.org
git at git.haskell.org
Fri Apr 21 16:56:23 UTC 2017
Repository : ssh://git@git.haskell.org/time
On branches: format-widths,ghc,master,tasty
Link : http://git.haskell.org/packages/time.git/commitdiff/a634d251ef3a1fd48e5d143fcd09d03adfa04bc8
>---------------------------------------------------------------
commit a634d251ef3a1fd48e5d143fcd09d03adfa04bc8
Author: Ashley Yakeley <ashley at yakeley.org>
Date: Sun Jan 15 12:05:34 2017 -0800
rename unixEpochDay to systemEpochDay
>---------------------------------------------------------------
a634d251ef3a1fd48e5d143fcd09d03adfa04bc8
lib/Data/Time/Clock/POSIX.hs | 4 ++--
lib/Data/Time/Clock/System.hs | 16 ++++++++--------
test/Test/ClockConversion.hs | 12 ++++++------
3 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/lib/Data/Time/Clock/POSIX.hs b/lib/Data/Time/Clock/POSIX.hs
index d634605..2fd2122 100644
--- a/lib/Data/Time/Clock/POSIX.hs
+++ b/lib/Data/Time/Clock/POSIX.hs
@@ -15,11 +15,11 @@ import Data.Fixed
posixSecondsToUTCTime :: POSIXTime -> UTCTime
posixSecondsToUTCTime i = let
(d,t) = divMod' i posixDayLength
- in UTCTime (addDays d unixEpochDay) (realToFrac t)
+ in UTCTime (addDays d systemEpochDay) (realToFrac t)
utcTimeToPOSIXSeconds :: UTCTime -> POSIXTime
utcTimeToPOSIXSeconds (UTCTime d t) =
- (fromInteger (diffDays d unixEpochDay) * posixDayLength) + min posixDayLength (realToFrac t)
+ (fromInteger (diffDays d systemEpochDay) * posixDayLength) + min posixDayLength (realToFrac t)
systemToPOSIXTime :: SystemTime -> POSIXTime
systemToPOSIXTime (MkSystemTime s ns) = (fromIntegral s) + (fromIntegral ns) * 1E-9
diff --git a/lib/Data/Time/Clock/System.hs b/lib/Data/Time/Clock/System.hs
index b9be502..a9664bc 100644
--- a/lib/Data/Time/Clock/System.hs
+++ b/lib/Data/Time/Clock/System.hs
@@ -1,6 +1,6 @@
module Data.Time.Clock.System
(
- unixEpochDay,
+ systemEpochDay,
SystemTime(..),
truncateSystemTimeLeapSecond,
getSystemTime,
@@ -28,7 +28,7 @@ systemToUTCTime (MkSystemTime seconds nanoseconds) = let
(days, timeSeconds) = seconds `divMod` 86400
day :: Day
- day = addDays (fromIntegral days) unixEpochDay
+ day = addDays (fromIntegral days) systemEpochDay
timeNanoseconds :: Int64
timeNanoseconds = timeSeconds * 1000000000 + (fromIntegral nanoseconds)
@@ -43,7 +43,7 @@ systemToUTCTime (MkSystemTime seconds nanoseconds) = let
utcToSystemTime :: UTCTime -> SystemTime
utcToSystemTime (UTCTime day time) = let
days :: Int64
- days = fromIntegral $ diffDays day unixEpochDay
+ days = fromIntegral $ diffDays day systemEpochDay
timePicoseconds :: Int64
timePicoseconds = fromIntegral $ diffTimeToPicoseconds time
@@ -60,14 +60,14 @@ utcToSystemTime (UTCTime day time) = let
in MkSystemTime seconds $ fromIntegral nanoseconds
-unixEpochAbsolute :: AbsoluteTime
-unixEpochAbsolute = taiNominalDayStart unixEpochDay
+systemEpochAbsolute :: AbsoluteTime
+systemEpochAbsolute = taiNominalDayStart systemEpochDay
systemToTAITime :: SystemTime -> AbsoluteTime
systemToTAITime (MkSystemTime s ns) = let
diff :: DiffTime
diff = (fromIntegral s) + (fromIntegral ns) * 1E-9
- in addAbsoluteTime diff unixEpochAbsolute
+ in addAbsoluteTime diff systemEpochAbsolute
-unixEpochDay :: Day
-unixEpochDay = ModifiedJulianDay 40587
+systemEpochDay :: Day
+systemEpochDay = ModifiedJulianDay 40587
diff --git a/test/Test/ClockConversion.hs b/test/Test/ClockConversion.hs
index b968620..095bc3a 100644
--- a/test/Test/ClockConversion.hs
+++ b/test/Test/ClockConversion.hs
@@ -15,10 +15,10 @@ testClockConversion = testGroup "clock conversion" $ let
]
in
[
- testPair (MkSystemTime 0 0,UTCTime unixEpochDay 0),
- testPair (MkSystemTime 86399 0,UTCTime unixEpochDay 86399),
- testPair (MkSystemTime 86399 999999999,UTCTime unixEpochDay 86399.999999999),
- testPair (MkSystemTime 86399 1000000000,UTCTime unixEpochDay 86400),
- testPair (MkSystemTime 86399 1999999999,UTCTime unixEpochDay 86400.999999999),
- testPair (MkSystemTime 86400 0,UTCTime (succ unixEpochDay) 0)
+ testPair (MkSystemTime 0 0,UTCTime systemEpochDay 0),
+ testPair (MkSystemTime 86399 0,UTCTime systemEpochDay 86399),
+ testPair (MkSystemTime 86399 999999999,UTCTime systemEpochDay 86399.999999999),
+ testPair (MkSystemTime 86399 1000000000,UTCTime systemEpochDay 86400),
+ testPair (MkSystemTime 86399 1999999999,UTCTime systemEpochDay 86400.999999999),
+ testPair (MkSystemTime 86400 0,UTCTime (succ systemEpochDay) 0)
]
More information about the ghc-commits
mailing list