#include "HsConfigure.h"
module Data.Time.Clock.Internal.AbsoluteTime
(
AbsoluteTime,taiEpoch,addAbsoluteTime,diffAbsoluteTime,
taiNominalDayStart,
) 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
newtype AbsoluteTime = MkAbsoluteTime DiffTime deriving (Eq,Ord
#if LANGUAGE_DeriveDataTypeable
#if LANGUAGE_Rank2Types
#if HAS_DataPico
,Data, Typeable
#endif
#endif
#endif
)
instance NFData AbsoluteTime where
rnf (MkAbsoluteTime a) = rnf a
taiEpoch :: AbsoluteTime
taiEpoch = MkAbsoluteTime 0
taiNominalDayStart :: Day -> AbsoluteTime
taiNominalDayStart day = MkAbsoluteTime $ realToFrac $ (toModifiedJulianDay day) * 86400
addAbsoluteTime :: DiffTime -> AbsoluteTime -> AbsoluteTime
addAbsoluteTime t (MkAbsoluteTime a) = MkAbsoluteTime (a + t)
diffAbsoluteTime :: AbsoluteTime -> AbsoluteTime -> DiffTime
diffAbsoluteTime (MkAbsoluteTime a) (MkAbsoluteTime b) = a - b