[commit: packages/time] master: TAI documentation (0782592)

git at git.haskell.org git at git.haskell.org
Sun Dec 20 07:46:53 UTC 2015


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

On branch  : master
Link       : http://git.haskell.org/packages/time.git/commitdiff/07825921e2e187d56a1e0838ea35d13d733ffb66

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

commit 07825921e2e187d56a1e0838ea35d13d733ffb66
Author: Ashley Yakeley <ashley at semantic.org>
Date:   Sun May 8 21:08:36 2005 -0700

    TAI documentation
    
    darcs-hash:20050509040836-ac6dd-189305d5b41c695936e994099c0f6b0f5f952fbf


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

07825921e2e187d56a1e0838ea35d13d733ffb66
 System/Time/TAI.hs | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/System/Time/TAI.hs b/System/Time/TAI.hs
index 8cd7315..f78eab0 100644
--- a/System/Time/TAI.hs
+++ b/System/Time/TAI.hs
@@ -1,10 +1,10 @@
 {-# OPTIONS -Wall -Werror #-}
 
--- | most people won't need this module
+-- | TAI and leap-second tables for converting to UTC: most people won't need this module.
 module System.Time.TAI
 (
 	-- TAI arithmetic
-	AbsoluteTime,addAbsoluteTime,diffAbsoluteTime,
+	AbsoluteTime,taiEpoch,addAbsoluteTime,diffAbsoluteTime,
 
 	-- leap-second table type
 	LeapSecondTable,
@@ -15,16 +15,24 @@ module System.Time.TAI
 
 import System.Time.Clock
 
--- | TAI as DiffTime from epoch
+-- | AbsoluteTime is TAI, time as measured by a clock.
 newtype AbsoluteTime = MkAbsoluteTime DiffTime deriving (Eq,Ord)
 
+-- | The epoch of TAI, which is 
+taiEpoch :: AbsoluteTime
+taiEpoch = MkAbsoluteTime 0
+
+-- | addAbsoluteTime a b = a + b
 addAbsoluteTime :: DiffTime -> AbsoluteTime -> AbsoluteTime
 addAbsoluteTime t (MkAbsoluteTime a) = MkAbsoluteTime (t + a)
 
+-- | diffAbsoluteTime a b = a - b
 diffAbsoluteTime :: AbsoluteTime -> AbsoluteTime -> DiffTime
 diffAbsoluteTime (MkAbsoluteTime a) (MkAbsoluteTime b) = a - b
 
--- | TAI - UTC during this day
+-- | TAI - UTC during this day.
+-- No table is provided, as any program compiled with it would become
+-- out of date in six months.
 type LeapSecondTable = ModJulianDay -> Integer
 
 utcDayLength :: LeapSecondTable -> ModJulianDay -> DiffTime
@@ -35,4 +43,4 @@ utcToTAITime table (UTCTime day dtime) = MkAbsoluteTime
 	((realToFrac (day * 86400 + (table day))) + dtime)
 
 taiToUTCTime :: LeapSecondTable -> AbsoluteTime -> UTCTime
-taiToUTCTime table (MkAbsoluteTime t) = undefined table t
+taiToUTCTime table (MkAbsoluteTime t) = undefined table t -- WRONG



More information about the ghc-commits mailing list