{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DeriveDataTypeable #-}
module Data.Hourglass.Epoch
(
ElapsedSince(..)
, ElapsedSinceP(..)
, Epoch(..)
, UnixEpoch(..)
, WindowsEpoch(..)
) where
import Data.Data
import Control.DeepSeq
import Data.Hourglass.Types
import Data.Hourglass.Time
newtype ElapsedSince epoch = ElapsedSince Seconds
deriving (Int -> ElapsedSince epoch -> ShowS
[ElapsedSince epoch] -> ShowS
ElapsedSince epoch -> String
(Int -> ElapsedSince epoch -> ShowS)
-> (ElapsedSince epoch -> String)
-> ([ElapsedSince epoch] -> ShowS)
-> Show (ElapsedSince epoch)
forall epoch. Int -> ElapsedSince epoch -> ShowS
forall epoch. [ElapsedSince epoch] -> ShowS
forall epoch. ElapsedSince epoch -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall epoch. Int -> ElapsedSince epoch -> ShowS
showsPrec :: Int -> ElapsedSince epoch -> ShowS
$cshow :: forall epoch. ElapsedSince epoch -> String
show :: ElapsedSince epoch -> String
$cshowList :: forall epoch. [ElapsedSince epoch] -> ShowS
showList :: [ElapsedSince epoch] -> ShowS
Show,ReadPrec [ElapsedSince epoch]
ReadPrec (ElapsedSince epoch)
Int -> ReadS (ElapsedSince epoch)
ReadS [ElapsedSince epoch]
(Int -> ReadS (ElapsedSince epoch))
-> ReadS [ElapsedSince epoch]
-> ReadPrec (ElapsedSince epoch)
-> ReadPrec [ElapsedSince epoch]
-> Read (ElapsedSince epoch)
forall epoch. ReadPrec [ElapsedSince epoch]
forall epoch. ReadPrec (ElapsedSince epoch)
forall epoch. Int -> ReadS (ElapsedSince epoch)
forall epoch. ReadS [ElapsedSince epoch]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: forall epoch. Int -> ReadS (ElapsedSince epoch)
readsPrec :: Int -> ReadS (ElapsedSince epoch)
$creadList :: forall epoch. ReadS [ElapsedSince epoch]
readList :: ReadS [ElapsedSince epoch]
$creadPrec :: forall epoch. ReadPrec (ElapsedSince epoch)
readPrec :: ReadPrec (ElapsedSince epoch)
$creadListPrec :: forall epoch. ReadPrec [ElapsedSince epoch]
readListPrec :: ReadPrec [ElapsedSince epoch]
Read,ElapsedSince epoch -> ElapsedSince epoch -> Bool
(ElapsedSince epoch -> ElapsedSince epoch -> Bool)
-> (ElapsedSince epoch -> ElapsedSince epoch -> Bool)
-> Eq (ElapsedSince epoch)
forall epoch. ElapsedSince epoch -> ElapsedSince epoch -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall epoch. ElapsedSince epoch -> ElapsedSince epoch -> Bool
== :: ElapsedSince epoch -> ElapsedSince epoch -> Bool
$c/= :: forall epoch. ElapsedSince epoch -> ElapsedSince epoch -> Bool
/= :: ElapsedSince epoch -> ElapsedSince epoch -> Bool
Eq,Eq (ElapsedSince epoch)
Eq (ElapsedSince epoch) =>
(ElapsedSince epoch -> ElapsedSince epoch -> Ordering)
-> (ElapsedSince epoch -> ElapsedSince epoch -> Bool)
-> (ElapsedSince epoch -> ElapsedSince epoch -> Bool)
-> (ElapsedSince epoch -> ElapsedSince epoch -> Bool)
-> (ElapsedSince epoch -> ElapsedSince epoch -> Bool)
-> (ElapsedSince epoch -> ElapsedSince epoch -> ElapsedSince epoch)
-> (ElapsedSince epoch -> ElapsedSince epoch -> ElapsedSince epoch)
-> Ord (ElapsedSince epoch)
ElapsedSince epoch -> ElapsedSince epoch -> Bool
ElapsedSince epoch -> ElapsedSince epoch -> Ordering
ElapsedSince epoch -> ElapsedSince epoch -> ElapsedSince epoch
forall epoch. Eq (ElapsedSince epoch)
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall epoch. ElapsedSince epoch -> ElapsedSince epoch -> Bool
forall epoch. ElapsedSince epoch -> ElapsedSince epoch -> Ordering
forall epoch.
ElapsedSince epoch -> ElapsedSince epoch -> ElapsedSince epoch
$ccompare :: forall epoch. ElapsedSince epoch -> ElapsedSince epoch -> Ordering
compare :: ElapsedSince epoch -> ElapsedSince epoch -> Ordering
$c< :: forall epoch. ElapsedSince epoch -> ElapsedSince epoch -> Bool
< :: ElapsedSince epoch -> ElapsedSince epoch -> Bool
$c<= :: forall epoch. ElapsedSince epoch -> ElapsedSince epoch -> Bool
<= :: ElapsedSince epoch -> ElapsedSince epoch -> Bool
$c> :: forall epoch. ElapsedSince epoch -> ElapsedSince epoch -> Bool
> :: ElapsedSince epoch -> ElapsedSince epoch -> Bool
$c>= :: forall epoch. ElapsedSince epoch -> ElapsedSince epoch -> Bool
>= :: ElapsedSince epoch -> ElapsedSince epoch -> Bool
$cmax :: forall epoch.
ElapsedSince epoch -> ElapsedSince epoch -> ElapsedSince epoch
max :: ElapsedSince epoch -> ElapsedSince epoch -> ElapsedSince epoch
$cmin :: forall epoch.
ElapsedSince epoch -> ElapsedSince epoch -> ElapsedSince epoch
min :: ElapsedSince epoch -> ElapsedSince epoch -> ElapsedSince epoch
Ord,Integer -> ElapsedSince epoch
ElapsedSince epoch -> ElapsedSince epoch
ElapsedSince epoch -> ElapsedSince epoch -> ElapsedSince epoch
(ElapsedSince epoch -> ElapsedSince epoch -> ElapsedSince epoch)
-> (ElapsedSince epoch -> ElapsedSince epoch -> ElapsedSince epoch)
-> (ElapsedSince epoch -> ElapsedSince epoch -> ElapsedSince epoch)
-> (ElapsedSince epoch -> ElapsedSince epoch)
-> (ElapsedSince epoch -> ElapsedSince epoch)
-> (ElapsedSince epoch -> ElapsedSince epoch)
-> (Integer -> ElapsedSince epoch)
-> Num (ElapsedSince epoch)
forall epoch. Integer -> ElapsedSince epoch
forall epoch. ElapsedSince epoch -> ElapsedSince epoch
forall epoch.
ElapsedSince epoch -> ElapsedSince epoch -> ElapsedSince epoch
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
$c+ :: forall epoch.
ElapsedSince epoch -> ElapsedSince epoch -> ElapsedSince epoch
+ :: ElapsedSince epoch -> ElapsedSince epoch -> ElapsedSince epoch
$c- :: forall epoch.
ElapsedSince epoch -> ElapsedSince epoch -> ElapsedSince epoch
- :: ElapsedSince epoch -> ElapsedSince epoch -> ElapsedSince epoch
$c* :: forall epoch.
ElapsedSince epoch -> ElapsedSince epoch -> ElapsedSince epoch
* :: ElapsedSince epoch -> ElapsedSince epoch -> ElapsedSince epoch
$cnegate :: forall epoch. ElapsedSince epoch -> ElapsedSince epoch
negate :: ElapsedSince epoch -> ElapsedSince epoch
$cabs :: forall epoch. ElapsedSince epoch -> ElapsedSince epoch
abs :: ElapsedSince epoch -> ElapsedSince epoch
$csignum :: forall epoch. ElapsedSince epoch -> ElapsedSince epoch
signum :: ElapsedSince epoch -> ElapsedSince epoch
$cfromInteger :: forall epoch. Integer -> ElapsedSince epoch
fromInteger :: Integer -> ElapsedSince epoch
Num,Typeable (ElapsedSince epoch)
Typeable (ElapsedSince epoch) =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ElapsedSince epoch
-> c (ElapsedSince epoch))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ElapsedSince epoch))
-> (ElapsedSince epoch -> Constr)
-> (ElapsedSince epoch -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (ElapsedSince epoch)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ElapsedSince epoch)))
-> ((forall b. Data b => b -> b)
-> ElapsedSince epoch -> ElapsedSince epoch)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ElapsedSince epoch -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ElapsedSince epoch -> r)
-> (forall u.
(forall d. Data d => d -> u) -> ElapsedSince epoch -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> ElapsedSince epoch -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ElapsedSince epoch -> m (ElapsedSince epoch))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ElapsedSince epoch -> m (ElapsedSince epoch))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ElapsedSince epoch -> m (ElapsedSince epoch))
-> Data (ElapsedSince epoch)
ElapsedSince epoch -> Constr
ElapsedSince epoch -> DataType
(forall b. Data b => b -> b)
-> ElapsedSince epoch -> ElapsedSince epoch
forall epoch. Data epoch => Typeable (ElapsedSince epoch)
forall epoch. Data epoch => ElapsedSince epoch -> Constr
forall epoch. Data epoch => ElapsedSince epoch -> DataType
forall epoch.
Data epoch =>
(forall b. Data b => b -> b)
-> ElapsedSince epoch -> ElapsedSince epoch
forall epoch u.
Data epoch =>
Int -> (forall d. Data d => d -> u) -> ElapsedSince epoch -> u
forall epoch u.
Data epoch =>
(forall d. Data d => d -> u) -> ElapsedSince epoch -> [u]
forall epoch r r'.
Data epoch =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ElapsedSince epoch -> r
forall epoch r r'.
Data epoch =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ElapsedSince epoch -> r
forall epoch (m :: * -> *).
(Data epoch, Monad m) =>
(forall d. Data d => d -> m d)
-> ElapsedSince epoch -> m (ElapsedSince epoch)
forall epoch (m :: * -> *).
(Data epoch, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> ElapsedSince epoch -> m (ElapsedSince epoch)
forall epoch (c :: * -> *).
Data epoch =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ElapsedSince epoch)
forall epoch (c :: * -> *).
Data epoch =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ElapsedSince epoch
-> c (ElapsedSince epoch)
forall epoch (t :: * -> *) (c :: * -> *).
(Data epoch, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (ElapsedSince epoch))
forall epoch (t :: * -> * -> *) (c :: * -> *).
(Data epoch, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ElapsedSince epoch))
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> ElapsedSince epoch -> u
forall u. (forall d. Data d => d -> u) -> ElapsedSince epoch -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ElapsedSince epoch -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ElapsedSince epoch -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ElapsedSince epoch -> m (ElapsedSince epoch)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ElapsedSince epoch -> m (ElapsedSince epoch)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ElapsedSince epoch)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ElapsedSince epoch
-> c (ElapsedSince epoch)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (ElapsedSince epoch))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ElapsedSince epoch))
$cgfoldl :: forall epoch (c :: * -> *).
Data epoch =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ElapsedSince epoch
-> c (ElapsedSince epoch)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ElapsedSince epoch
-> c (ElapsedSince epoch)
$cgunfold :: forall epoch (c :: * -> *).
Data epoch =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ElapsedSince epoch)
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ElapsedSince epoch)
$ctoConstr :: forall epoch. Data epoch => ElapsedSince epoch -> Constr
toConstr :: ElapsedSince epoch -> Constr
$cdataTypeOf :: forall epoch. Data epoch => ElapsedSince epoch -> DataType
dataTypeOf :: ElapsedSince epoch -> DataType
$cdataCast1 :: forall epoch (t :: * -> *) (c :: * -> *).
(Data epoch, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (ElapsedSince epoch))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (ElapsedSince epoch))
$cdataCast2 :: forall epoch (t :: * -> * -> *) (c :: * -> *).
(Data epoch, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ElapsedSince epoch))
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ElapsedSince epoch))
$cgmapT :: forall epoch.
Data epoch =>
(forall b. Data b => b -> b)
-> ElapsedSince epoch -> ElapsedSince epoch
gmapT :: (forall b. Data b => b -> b)
-> ElapsedSince epoch -> ElapsedSince epoch
$cgmapQl :: forall epoch r r'.
Data epoch =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ElapsedSince epoch -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ElapsedSince epoch -> r
$cgmapQr :: forall epoch r r'.
Data epoch =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ElapsedSince epoch -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ElapsedSince epoch -> r
$cgmapQ :: forall epoch u.
Data epoch =>
(forall d. Data d => d -> u) -> ElapsedSince epoch -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> ElapsedSince epoch -> [u]
$cgmapQi :: forall epoch u.
Data epoch =>
Int -> (forall d. Data d => d -> u) -> ElapsedSince epoch -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> ElapsedSince epoch -> u
$cgmapM :: forall epoch (m :: * -> *).
(Data epoch, Monad m) =>
(forall d. Data d => d -> m d)
-> ElapsedSince epoch -> m (ElapsedSince epoch)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ElapsedSince epoch -> m (ElapsedSince epoch)
$cgmapMp :: forall epoch (m :: * -> *).
(Data epoch, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> ElapsedSince epoch -> m (ElapsedSince epoch)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ElapsedSince epoch -> m (ElapsedSince epoch)
$cgmapMo :: forall epoch (m :: * -> *).
(Data epoch, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> ElapsedSince epoch -> m (ElapsedSince epoch)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ElapsedSince epoch -> m (ElapsedSince epoch)
Data,Typeable,ElapsedSince epoch -> ()
(ElapsedSince epoch -> ()) -> NFData (ElapsedSince epoch)
forall epoch. ElapsedSince epoch -> ()
forall a. (a -> ()) -> NFData a
$crnf :: forall epoch. ElapsedSince epoch -> ()
rnf :: ElapsedSince epoch -> ()
NFData)
data ElapsedSinceP epoch = ElapsedSinceP {-# UNPACK #-} !(ElapsedSince epoch)
{-# UNPACK #-} !NanoSeconds
deriving (Int -> ElapsedSinceP epoch -> ShowS
[ElapsedSinceP epoch] -> ShowS
ElapsedSinceP epoch -> String
(Int -> ElapsedSinceP epoch -> ShowS)
-> (ElapsedSinceP epoch -> String)
-> ([ElapsedSinceP epoch] -> ShowS)
-> Show (ElapsedSinceP epoch)
forall epoch. Int -> ElapsedSinceP epoch -> ShowS
forall epoch. [ElapsedSinceP epoch] -> ShowS
forall epoch. ElapsedSinceP epoch -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall epoch. Int -> ElapsedSinceP epoch -> ShowS
showsPrec :: Int -> ElapsedSinceP epoch -> ShowS
$cshow :: forall epoch. ElapsedSinceP epoch -> String
show :: ElapsedSinceP epoch -> String
$cshowList :: forall epoch. [ElapsedSinceP epoch] -> ShowS
showList :: [ElapsedSinceP epoch] -> ShowS
Show,ReadPrec [ElapsedSinceP epoch]
ReadPrec (ElapsedSinceP epoch)
Int -> ReadS (ElapsedSinceP epoch)
ReadS [ElapsedSinceP epoch]
(Int -> ReadS (ElapsedSinceP epoch))
-> ReadS [ElapsedSinceP epoch]
-> ReadPrec (ElapsedSinceP epoch)
-> ReadPrec [ElapsedSinceP epoch]
-> Read (ElapsedSinceP epoch)
forall epoch. ReadPrec [ElapsedSinceP epoch]
forall epoch. ReadPrec (ElapsedSinceP epoch)
forall epoch. Int -> ReadS (ElapsedSinceP epoch)
forall epoch. ReadS [ElapsedSinceP epoch]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: forall epoch. Int -> ReadS (ElapsedSinceP epoch)
readsPrec :: Int -> ReadS (ElapsedSinceP epoch)
$creadList :: forall epoch. ReadS [ElapsedSinceP epoch]
readList :: ReadS [ElapsedSinceP epoch]
$creadPrec :: forall epoch. ReadPrec (ElapsedSinceP epoch)
readPrec :: ReadPrec (ElapsedSinceP epoch)
$creadListPrec :: forall epoch. ReadPrec [ElapsedSinceP epoch]
readListPrec :: ReadPrec [ElapsedSinceP epoch]
Read,ElapsedSinceP epoch -> ElapsedSinceP epoch -> Bool
(ElapsedSinceP epoch -> ElapsedSinceP epoch -> Bool)
-> (ElapsedSinceP epoch -> ElapsedSinceP epoch -> Bool)
-> Eq (ElapsedSinceP epoch)
forall epoch. ElapsedSinceP epoch -> ElapsedSinceP epoch -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall epoch. ElapsedSinceP epoch -> ElapsedSinceP epoch -> Bool
== :: ElapsedSinceP epoch -> ElapsedSinceP epoch -> Bool
$c/= :: forall epoch. ElapsedSinceP epoch -> ElapsedSinceP epoch -> Bool
/= :: ElapsedSinceP epoch -> ElapsedSinceP epoch -> Bool
Eq,Eq (ElapsedSinceP epoch)
Eq (ElapsedSinceP epoch) =>
(ElapsedSinceP epoch -> ElapsedSinceP epoch -> Ordering)
-> (ElapsedSinceP epoch -> ElapsedSinceP epoch -> Bool)
-> (ElapsedSinceP epoch -> ElapsedSinceP epoch -> Bool)
-> (ElapsedSinceP epoch -> ElapsedSinceP epoch -> Bool)
-> (ElapsedSinceP epoch -> ElapsedSinceP epoch -> Bool)
-> (ElapsedSinceP epoch
-> ElapsedSinceP epoch -> ElapsedSinceP epoch)
-> (ElapsedSinceP epoch
-> ElapsedSinceP epoch -> ElapsedSinceP epoch)
-> Ord (ElapsedSinceP epoch)
ElapsedSinceP epoch -> ElapsedSinceP epoch -> Bool
ElapsedSinceP epoch -> ElapsedSinceP epoch -> Ordering
ElapsedSinceP epoch -> ElapsedSinceP epoch -> ElapsedSinceP epoch
forall epoch. Eq (ElapsedSinceP epoch)
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall epoch. ElapsedSinceP epoch -> ElapsedSinceP epoch -> Bool
forall epoch.
ElapsedSinceP epoch -> ElapsedSinceP epoch -> Ordering
forall epoch.
ElapsedSinceP epoch -> ElapsedSinceP epoch -> ElapsedSinceP epoch
$ccompare :: forall epoch.
ElapsedSinceP epoch -> ElapsedSinceP epoch -> Ordering
compare :: ElapsedSinceP epoch -> ElapsedSinceP epoch -> Ordering
$c< :: forall epoch. ElapsedSinceP epoch -> ElapsedSinceP epoch -> Bool
< :: ElapsedSinceP epoch -> ElapsedSinceP epoch -> Bool
$c<= :: forall epoch. ElapsedSinceP epoch -> ElapsedSinceP epoch -> Bool
<= :: ElapsedSinceP epoch -> ElapsedSinceP epoch -> Bool
$c> :: forall epoch. ElapsedSinceP epoch -> ElapsedSinceP epoch -> Bool
> :: ElapsedSinceP epoch -> ElapsedSinceP epoch -> Bool
$c>= :: forall epoch. ElapsedSinceP epoch -> ElapsedSinceP epoch -> Bool
>= :: ElapsedSinceP epoch -> ElapsedSinceP epoch -> Bool
$cmax :: forall epoch.
ElapsedSinceP epoch -> ElapsedSinceP epoch -> ElapsedSinceP epoch
max :: ElapsedSinceP epoch -> ElapsedSinceP epoch -> ElapsedSinceP epoch
$cmin :: forall epoch.
ElapsedSinceP epoch -> ElapsedSinceP epoch -> ElapsedSinceP epoch
min :: ElapsedSinceP epoch -> ElapsedSinceP epoch -> ElapsedSinceP epoch
Ord,Typeable (ElapsedSinceP epoch)
Typeable (ElapsedSinceP epoch) =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ElapsedSinceP epoch
-> c (ElapsedSinceP epoch))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ElapsedSinceP epoch))
-> (ElapsedSinceP epoch -> Constr)
-> (ElapsedSinceP epoch -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (ElapsedSinceP epoch)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ElapsedSinceP epoch)))
-> ((forall b. Data b => b -> b)
-> ElapsedSinceP epoch -> ElapsedSinceP epoch)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ElapsedSinceP epoch -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ElapsedSinceP epoch -> r)
-> (forall u.
(forall d. Data d => d -> u) -> ElapsedSinceP epoch -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> ElapsedSinceP epoch -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ElapsedSinceP epoch -> m (ElapsedSinceP epoch))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ElapsedSinceP epoch -> m (ElapsedSinceP epoch))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ElapsedSinceP epoch -> m (ElapsedSinceP epoch))
-> Data (ElapsedSinceP epoch)
ElapsedSinceP epoch -> Constr
ElapsedSinceP epoch -> DataType
(forall b. Data b => b -> b)
-> ElapsedSinceP epoch -> ElapsedSinceP epoch
forall epoch. Data epoch => Typeable (ElapsedSinceP epoch)
forall epoch. Data epoch => ElapsedSinceP epoch -> Constr
forall epoch. Data epoch => ElapsedSinceP epoch -> DataType
forall epoch.
Data epoch =>
(forall b. Data b => b -> b)
-> ElapsedSinceP epoch -> ElapsedSinceP epoch
forall epoch u.
Data epoch =>
Int -> (forall d. Data d => d -> u) -> ElapsedSinceP epoch -> u
forall epoch u.
Data epoch =>
(forall d. Data d => d -> u) -> ElapsedSinceP epoch -> [u]
forall epoch r r'.
Data epoch =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ElapsedSinceP epoch -> r
forall epoch r r'.
Data epoch =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ElapsedSinceP epoch -> r
forall epoch (m :: * -> *).
(Data epoch, Monad m) =>
(forall d. Data d => d -> m d)
-> ElapsedSinceP epoch -> m (ElapsedSinceP epoch)
forall epoch (m :: * -> *).
(Data epoch, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> ElapsedSinceP epoch -> m (ElapsedSinceP epoch)
forall epoch (c :: * -> *).
Data epoch =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ElapsedSinceP epoch)
forall epoch (c :: * -> *).
Data epoch =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ElapsedSinceP epoch
-> c (ElapsedSinceP epoch)
forall epoch (t :: * -> *) (c :: * -> *).
(Data epoch, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (ElapsedSinceP epoch))
forall epoch (t :: * -> * -> *) (c :: * -> *).
(Data epoch, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ElapsedSinceP epoch))
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> ElapsedSinceP epoch -> u
forall u.
(forall d. Data d => d -> u) -> ElapsedSinceP epoch -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ElapsedSinceP epoch -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ElapsedSinceP epoch -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ElapsedSinceP epoch -> m (ElapsedSinceP epoch)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ElapsedSinceP epoch -> m (ElapsedSinceP epoch)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ElapsedSinceP epoch)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ElapsedSinceP epoch
-> c (ElapsedSinceP epoch)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (ElapsedSinceP epoch))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ElapsedSinceP epoch))
$cgfoldl :: forall epoch (c :: * -> *).
Data epoch =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ElapsedSinceP epoch
-> c (ElapsedSinceP epoch)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> ElapsedSinceP epoch
-> c (ElapsedSinceP epoch)
$cgunfold :: forall epoch (c :: * -> *).
Data epoch =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ElapsedSinceP epoch)
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (ElapsedSinceP epoch)
$ctoConstr :: forall epoch. Data epoch => ElapsedSinceP epoch -> Constr
toConstr :: ElapsedSinceP epoch -> Constr
$cdataTypeOf :: forall epoch. Data epoch => ElapsedSinceP epoch -> DataType
dataTypeOf :: ElapsedSinceP epoch -> DataType
$cdataCast1 :: forall epoch (t :: * -> *) (c :: * -> *).
(Data epoch, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (ElapsedSinceP epoch))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (ElapsedSinceP epoch))
$cdataCast2 :: forall epoch (t :: * -> * -> *) (c :: * -> *).
(Data epoch, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ElapsedSinceP epoch))
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (ElapsedSinceP epoch))
$cgmapT :: forall epoch.
Data epoch =>
(forall b. Data b => b -> b)
-> ElapsedSinceP epoch -> ElapsedSinceP epoch
gmapT :: (forall b. Data b => b -> b)
-> ElapsedSinceP epoch -> ElapsedSinceP epoch
$cgmapQl :: forall epoch r r'.
Data epoch =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ElapsedSinceP epoch -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ElapsedSinceP epoch -> r
$cgmapQr :: forall epoch r r'.
Data epoch =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ElapsedSinceP epoch -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ElapsedSinceP epoch -> r
$cgmapQ :: forall epoch u.
Data epoch =>
(forall d. Data d => d -> u) -> ElapsedSinceP epoch -> [u]
gmapQ :: forall u.
(forall d. Data d => d -> u) -> ElapsedSinceP epoch -> [u]
$cgmapQi :: forall epoch u.
Data epoch =>
Int -> (forall d. Data d => d -> u) -> ElapsedSinceP epoch -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> ElapsedSinceP epoch -> u
$cgmapM :: forall epoch (m :: * -> *).
(Data epoch, Monad m) =>
(forall d. Data d => d -> m d)
-> ElapsedSinceP epoch -> m (ElapsedSinceP epoch)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> ElapsedSinceP epoch -> m (ElapsedSinceP epoch)
$cgmapMp :: forall epoch (m :: * -> *).
(Data epoch, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> ElapsedSinceP epoch -> m (ElapsedSinceP epoch)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ElapsedSinceP epoch -> m (ElapsedSinceP epoch)
$cgmapMo :: forall epoch (m :: * -> *).
(Data epoch, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> ElapsedSinceP epoch -> m (ElapsedSinceP epoch)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> ElapsedSinceP epoch -> m (ElapsedSinceP epoch)
Data,Typeable)
instance NFData (ElapsedSinceP e) where rnf :: ElapsedSinceP e -> ()
rnf ElapsedSinceP e
e = ElapsedSinceP e
e ElapsedSinceP e -> () -> ()
forall a b. a -> b -> b
`seq` ()
instance Num (ElapsedSinceP e) where
(ElapsedSinceP ElapsedSince e
e1 NanoSeconds
ns1) + :: ElapsedSinceP e -> ElapsedSinceP e -> ElapsedSinceP e
+ (ElapsedSinceP ElapsedSince e
e2 NanoSeconds
ns2) = ElapsedSince e -> NanoSeconds -> ElapsedSinceP e
forall epoch.
ElapsedSince epoch -> NanoSeconds -> ElapsedSinceP epoch
ElapsedSinceP (ElapsedSince e
e1ElapsedSince e -> ElapsedSince e -> ElapsedSince e
forall a. Num a => a -> a -> a
+ElapsedSince e
e2) (NanoSeconds
ns1NanoSeconds -> NanoSeconds -> NanoSeconds
forall a. Num a => a -> a -> a
+NanoSeconds
ns2)
(ElapsedSinceP ElapsedSince e
e1 NanoSeconds
ns1) - :: ElapsedSinceP e -> ElapsedSinceP e -> ElapsedSinceP e
- (ElapsedSinceP ElapsedSince e
e2 NanoSeconds
ns2) = ElapsedSince e -> NanoSeconds -> ElapsedSinceP e
forall epoch.
ElapsedSince epoch -> NanoSeconds -> ElapsedSinceP epoch
ElapsedSinceP (ElapsedSince e
e1ElapsedSince e -> ElapsedSince e -> ElapsedSince e
forall a. Num a => a -> a -> a
-ElapsedSince e
e2) (NanoSeconds
ns1NanoSeconds -> NanoSeconds -> NanoSeconds
forall a. Num a => a -> a -> a
-NanoSeconds
ns2)
(ElapsedSinceP ElapsedSince e
e1 NanoSeconds
ns1) * :: ElapsedSinceP e -> ElapsedSinceP e -> ElapsedSinceP e
* (ElapsedSinceP ElapsedSince e
e2 NanoSeconds
ns2) = ElapsedSince e -> NanoSeconds -> ElapsedSinceP e
forall epoch.
ElapsedSince epoch -> NanoSeconds -> ElapsedSinceP epoch
ElapsedSinceP (ElapsedSince e
e1ElapsedSince e -> ElapsedSince e -> ElapsedSince e
forall a. Num a => a -> a -> a
*ElapsedSince e
e2) (NanoSeconds
ns1NanoSeconds -> NanoSeconds -> NanoSeconds
forall a. Num a => a -> a -> a
*NanoSeconds
ns2)
negate :: ElapsedSinceP e -> ElapsedSinceP e
negate (ElapsedSinceP ElapsedSince e
e NanoSeconds
ns) = ElapsedSince e -> NanoSeconds -> ElapsedSinceP e
forall epoch.
ElapsedSince epoch -> NanoSeconds -> ElapsedSinceP epoch
ElapsedSinceP (ElapsedSince e -> ElapsedSince e
forall a. Num a => a -> a
negate ElapsedSince e
e) NanoSeconds
ns
abs :: ElapsedSinceP e -> ElapsedSinceP e
abs (ElapsedSinceP ElapsedSince e
e NanoSeconds
ns) = ElapsedSince e -> NanoSeconds -> ElapsedSinceP e
forall epoch.
ElapsedSince epoch -> NanoSeconds -> ElapsedSinceP epoch
ElapsedSinceP (ElapsedSince e -> ElapsedSince e
forall a. Num a => a -> a
abs ElapsedSince e
e) NanoSeconds
ns
signum :: ElapsedSinceP e -> ElapsedSinceP e
signum (ElapsedSinceP ElapsedSince e
e NanoSeconds
ns) = ElapsedSince e -> NanoSeconds -> ElapsedSinceP e
forall epoch.
ElapsedSince epoch -> NanoSeconds -> ElapsedSinceP epoch
ElapsedSinceP (ElapsedSince e -> ElapsedSince e
forall a. Num a => a -> a
signum ElapsedSince e
e) NanoSeconds
ns
fromInteger :: Integer -> ElapsedSinceP e
fromInteger Integer
i = ElapsedSince e -> NanoSeconds -> ElapsedSinceP e
forall epoch.
ElapsedSince epoch -> NanoSeconds -> ElapsedSinceP epoch
ElapsedSinceP (Seconds -> ElapsedSince e
forall epoch. Seconds -> ElapsedSince epoch
ElapsedSince (Integer -> Seconds
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
i)) NanoSeconds
0
class Epoch epoch where
epochName :: epoch -> String
epochDiffToUnix :: epoch -> Seconds
data UnixEpoch = UnixEpoch
deriving (Int -> UnixEpoch -> ShowS
[UnixEpoch] -> ShowS
UnixEpoch -> String
(Int -> UnixEpoch -> ShowS)
-> (UnixEpoch -> String)
-> ([UnixEpoch] -> ShowS)
-> Show UnixEpoch
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UnixEpoch -> ShowS
showsPrec :: Int -> UnixEpoch -> ShowS
$cshow :: UnixEpoch -> String
show :: UnixEpoch -> String
$cshowList :: [UnixEpoch] -> ShowS
showList :: [UnixEpoch] -> ShowS
Show,UnixEpoch -> UnixEpoch -> Bool
(UnixEpoch -> UnixEpoch -> Bool)
-> (UnixEpoch -> UnixEpoch -> Bool) -> Eq UnixEpoch
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UnixEpoch -> UnixEpoch -> Bool
== :: UnixEpoch -> UnixEpoch -> Bool
$c/= :: UnixEpoch -> UnixEpoch -> Bool
/= :: UnixEpoch -> UnixEpoch -> Bool
Eq)
instance Epoch UnixEpoch where
epochName :: UnixEpoch -> String
epochName UnixEpoch
_ = String
"unix"
epochDiffToUnix :: UnixEpoch -> Seconds
epochDiffToUnix UnixEpoch
_ = Seconds
0
data WindowsEpoch = WindowsEpoch
deriving (Int -> WindowsEpoch -> ShowS
[WindowsEpoch] -> ShowS
WindowsEpoch -> String
(Int -> WindowsEpoch -> ShowS)
-> (WindowsEpoch -> String)
-> ([WindowsEpoch] -> ShowS)
-> Show WindowsEpoch
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> WindowsEpoch -> ShowS
showsPrec :: Int -> WindowsEpoch -> ShowS
$cshow :: WindowsEpoch -> String
show :: WindowsEpoch -> String
$cshowList :: [WindowsEpoch] -> ShowS
showList :: [WindowsEpoch] -> ShowS
Show,WindowsEpoch -> WindowsEpoch -> Bool
(WindowsEpoch -> WindowsEpoch -> Bool)
-> (WindowsEpoch -> WindowsEpoch -> Bool) -> Eq WindowsEpoch
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: WindowsEpoch -> WindowsEpoch -> Bool
== :: WindowsEpoch -> WindowsEpoch -> Bool
$c/= :: WindowsEpoch -> WindowsEpoch -> Bool
/= :: WindowsEpoch -> WindowsEpoch -> Bool
Eq)
instance Epoch WindowsEpoch where
epochName :: WindowsEpoch -> String
epochName WindowsEpoch
_ = String
"windows"
epochDiffToUnix :: WindowsEpoch -> Seconds
epochDiffToUnix WindowsEpoch
_ = -Seconds
11644473600
instance Epoch epoch => Timeable (ElapsedSince epoch) where
timeGetElapsedP :: ElapsedSince epoch -> ElapsedP
timeGetElapsedP ElapsedSince epoch
es = Elapsed -> NanoSeconds -> ElapsedP
ElapsedP (Seconds -> Elapsed
Elapsed Seconds
e) NanoSeconds
0
where ElapsedSince Seconds
e = ElapsedSince epoch -> ElapsedSince UnixEpoch
forall e1 e2.
(Epoch e1, Epoch e2) =>
ElapsedSince e1 -> ElapsedSince e2
convertEpoch ElapsedSince epoch
es :: ElapsedSince UnixEpoch
timeGetElapsed :: ElapsedSince epoch -> Elapsed
timeGetElapsed ElapsedSince epoch
es = Seconds -> Elapsed
Elapsed Seconds
e
where ElapsedSince Seconds
e = ElapsedSince epoch -> ElapsedSince UnixEpoch
forall e1 e2.
(Epoch e1, Epoch e2) =>
ElapsedSince e1 -> ElapsedSince e2
convertEpoch ElapsedSince epoch
es :: ElapsedSince UnixEpoch
timeGetNanoSeconds :: ElapsedSince epoch -> NanoSeconds
timeGetNanoSeconds ElapsedSince epoch
_ = NanoSeconds
0
instance Epoch epoch => Time (ElapsedSince epoch) where
timeFromElapsedP :: ElapsedP -> ElapsedSince epoch
timeFromElapsedP (ElapsedP (Elapsed Seconds
e) NanoSeconds
_) =
ElapsedSince UnixEpoch -> ElapsedSince epoch
forall e1 e2.
(Epoch e1, Epoch e2) =>
ElapsedSince e1 -> ElapsedSince e2
convertEpoch (Seconds -> ElapsedSince UnixEpoch
forall epoch. Seconds -> ElapsedSince epoch
ElapsedSince Seconds
e :: ElapsedSince UnixEpoch)
instance Epoch epoch => Timeable (ElapsedSinceP epoch) where
timeGetElapsedP :: ElapsedSinceP epoch -> ElapsedP
timeGetElapsedP ElapsedSinceP epoch
es = Elapsed -> NanoSeconds -> ElapsedP
ElapsedP (Seconds -> Elapsed
Elapsed Seconds
e) NanoSeconds
ns
where ElapsedSinceP (ElapsedSince Seconds
e) NanoSeconds
ns = ElapsedSinceP epoch -> ElapsedSinceP UnixEpoch
forall e1 e2.
(Epoch e1, Epoch e2) =>
ElapsedSinceP e1 -> ElapsedSinceP e2
convertEpochP ElapsedSinceP epoch
es :: ElapsedSinceP UnixEpoch
timeGetNanoSeconds :: ElapsedSinceP epoch -> NanoSeconds
timeGetNanoSeconds (ElapsedSinceP ElapsedSince epoch
_ NanoSeconds
ns) = NanoSeconds
ns
instance Epoch epoch => Time (ElapsedSinceP epoch) where
timeFromElapsedP :: ElapsedP -> ElapsedSinceP epoch
timeFromElapsedP (ElapsedP (Elapsed Seconds
e) NanoSeconds
ns) = ElapsedSinceP UnixEpoch -> ElapsedSinceP epoch
forall e1 e2.
(Epoch e1, Epoch e2) =>
ElapsedSinceP e1 -> ElapsedSinceP e2
convertEpochP (ElapsedSince UnixEpoch -> NanoSeconds -> ElapsedSinceP UnixEpoch
forall epoch.
ElapsedSince epoch -> NanoSeconds -> ElapsedSinceP epoch
ElapsedSinceP (Seconds -> ElapsedSince UnixEpoch
forall epoch. Seconds -> ElapsedSince epoch
ElapsedSince Seconds
e) NanoSeconds
ns :: ElapsedSinceP UnixEpoch)
convertEpochWith :: (Epoch e1, Epoch e2) => (e1,e2) -> ElapsedSince e1 -> ElapsedSince e2
convertEpochWith :: forall e1 e2.
(Epoch e1, Epoch e2) =>
(e1, e2) -> ElapsedSince e1 -> ElapsedSince e2
convertEpochWith (e1
e1,e2
e2) (ElapsedSince Seconds
s1) = Seconds -> ElapsedSince e2
forall epoch. Seconds -> ElapsedSince epoch
ElapsedSince (Seconds
s1 Seconds -> Seconds -> Seconds
forall a. Num a => a -> a -> a
+ Seconds
diff)
where diff :: Seconds
diff = Seconds
d1 Seconds -> Seconds -> Seconds
forall a. Num a => a -> a -> a
- Seconds
d2
d1 :: Seconds
d1 = e1 -> Seconds
forall epoch. Epoch epoch => epoch -> Seconds
epochDiffToUnix e1
e1
d2 :: Seconds
d2 = e2 -> Seconds
forall epoch. Epoch epoch => epoch -> Seconds
epochDiffToUnix e2
e2
convertEpoch :: (Epoch e1, Epoch e2) => ElapsedSince e1 -> ElapsedSince e2
convertEpoch :: forall e1 e2.
(Epoch e1, Epoch e2) =>
ElapsedSince e1 -> ElapsedSince e2
convertEpoch = (e1, e2) -> ElapsedSince e1 -> ElapsedSince e2
forall e1 e2.
(Epoch e1, Epoch e2) =>
(e1, e2) -> ElapsedSince e1 -> ElapsedSince e2
convertEpochWith (e1
forall a. HasCallStack => a
undefined, e2
forall a. HasCallStack => a
undefined)
convertEpochPWith :: (Epoch e1, Epoch e2) => (e1,e2) -> ElapsedSinceP e1 -> ElapsedSinceP e2
convertEpochPWith :: forall e1 e2.
(Epoch e1, Epoch e2) =>
(e1, e2) -> ElapsedSinceP e1 -> ElapsedSinceP e2
convertEpochPWith (e1, e2)
es (ElapsedSinceP ElapsedSince e1
e1 NanoSeconds
n1) = ElapsedSince e2 -> NanoSeconds -> ElapsedSinceP e2
forall epoch.
ElapsedSince epoch -> NanoSeconds -> ElapsedSinceP epoch
ElapsedSinceP ((e1, e2) -> ElapsedSince e1 -> ElapsedSince e2
forall e1 e2.
(Epoch e1, Epoch e2) =>
(e1, e2) -> ElapsedSince e1 -> ElapsedSince e2
convertEpochWith (e1, e2)
es ElapsedSince e1
e1) NanoSeconds
n1
convertEpochP :: (Epoch e1, Epoch e2) => ElapsedSinceP e1 -> ElapsedSinceP e2
convertEpochP :: forall e1 e2.
(Epoch e1, Epoch e2) =>
ElapsedSinceP e1 -> ElapsedSinceP e2
convertEpochP = (e1, e2) -> ElapsedSinceP e1 -> ElapsedSinceP e2
forall e1 e2.
(Epoch e1, Epoch e2) =>
(e1, e2) -> ElapsedSinceP e1 -> ElapsedSinceP e2
convertEpochPWith (e1
forall a. HasCallStack => a
undefined, e2
forall a. HasCallStack => a
undefined)