hourglass-0.2.11: simple performant time related library

LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell2010

Data.Hourglass.Epoch

Contents

Description

Epoch tracking

Synopsis

computer time tracking with various epoch

newtype ElapsedSince epoch Source #

A number of seconds elapsed since an epoch.

Constructors

ElapsedSince Seconds 

Instances

Eq (ElapsedSince epoch) Source # 

Methods

(==) :: ElapsedSince epoch -> ElapsedSince epoch -> Bool #

(/=) :: ElapsedSince epoch -> ElapsedSince epoch -> Bool #

Data epoch => Data (ElapsedSince epoch) Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ElapsedSince epoch -> c (ElapsedSince epoch) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ElapsedSince epoch) #

toConstr :: ElapsedSince epoch -> Constr #

dataTypeOf :: ElapsedSince epoch -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (ElapsedSince epoch)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ElapsedSince epoch)) #

gmapT :: (forall b. Data b => b -> b) -> ElapsedSince epoch -> ElapsedSince epoch #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ElapsedSince epoch -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ElapsedSince epoch -> r #

gmapQ :: (forall d. Data d => d -> u) -> ElapsedSince epoch -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ElapsedSince epoch -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ElapsedSince epoch -> m (ElapsedSince epoch) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ElapsedSince epoch -> m (ElapsedSince epoch) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ElapsedSince epoch -> m (ElapsedSince epoch) #

Num (ElapsedSince epoch) Source # 

Methods

(+) :: ElapsedSince epoch -> ElapsedSince epoch -> ElapsedSince epoch #

(-) :: ElapsedSince epoch -> ElapsedSince epoch -> ElapsedSince epoch #

(*) :: ElapsedSince epoch -> ElapsedSince epoch -> ElapsedSince epoch #

negate :: ElapsedSince epoch -> ElapsedSince epoch #

abs :: ElapsedSince epoch -> ElapsedSince epoch #

signum :: ElapsedSince epoch -> ElapsedSince epoch #

fromInteger :: Integer -> ElapsedSince epoch #

Ord (ElapsedSince epoch) Source # 

Methods

compare :: 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 #

max :: ElapsedSince epoch -> ElapsedSince epoch -> ElapsedSince epoch #

min :: ElapsedSince epoch -> ElapsedSince epoch -> ElapsedSince epoch #

Read (ElapsedSince epoch) Source # 
Show (ElapsedSince epoch) Source # 

Methods

showsPrec :: Int -> ElapsedSince epoch -> ShowS #

show :: ElapsedSince epoch -> String #

showList :: [ElapsedSince epoch] -> ShowS #

NFData (ElapsedSince epoch) Source # 

Methods

rnf :: ElapsedSince epoch -> () #

Epoch epoch => Time (ElapsedSince epoch) Source # 
Epoch epoch => Timeable (ElapsedSince epoch) Source # 

data ElapsedSinceP epoch Source #

A number of seconds and nanoseconds elapsed since an epoch.

Constructors

ElapsedSinceP !(ElapsedSince epoch) !NanoSeconds 

Instances

Eq (ElapsedSinceP epoch) Source # 

Methods

(==) :: ElapsedSinceP epoch -> ElapsedSinceP epoch -> Bool #

(/=) :: ElapsedSinceP epoch -> ElapsedSinceP epoch -> Bool #

Data epoch => Data (ElapsedSinceP epoch) Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ElapsedSinceP epoch -> c (ElapsedSinceP epoch) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ElapsedSinceP epoch) #

toConstr :: ElapsedSinceP epoch -> Constr #

dataTypeOf :: ElapsedSinceP epoch -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (ElapsedSinceP epoch)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ElapsedSinceP epoch)) #

gmapT :: (forall b. Data b => b -> b) -> ElapsedSinceP epoch -> ElapsedSinceP epoch #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ElapsedSinceP epoch -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ElapsedSinceP epoch -> r #

gmapQ :: (forall d. Data d => d -> u) -> ElapsedSinceP epoch -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ElapsedSinceP epoch -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ElapsedSinceP epoch -> m (ElapsedSinceP epoch) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ElapsedSinceP epoch -> m (ElapsedSinceP epoch) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ElapsedSinceP epoch -> m (ElapsedSinceP epoch) #

Num (ElapsedSinceP e) Source # 
Ord (ElapsedSinceP epoch) Source # 

Methods

compare :: 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 #

max :: ElapsedSinceP epoch -> ElapsedSinceP epoch -> ElapsedSinceP epoch #

min :: ElapsedSinceP epoch -> ElapsedSinceP epoch -> ElapsedSinceP epoch #

Read (ElapsedSinceP epoch) Source # 
Show (ElapsedSinceP epoch) Source # 

Methods

showsPrec :: Int -> ElapsedSinceP epoch -> ShowS #

show :: ElapsedSinceP epoch -> String #

showList :: [ElapsedSinceP epoch] -> ShowS #

NFData (ElapsedSinceP e) Source # 

Methods

rnf :: ElapsedSinceP e -> () #

Epoch epoch => Time (ElapsedSinceP epoch) Source # 
Epoch epoch => Timeable (ElapsedSinceP epoch) Source # 

Epoch

class Epoch epoch where Source #

epoch related.

We use the well known Unix epoch as the reference timezone for doing conversion between epochs.

Each methods of this typeclass should not use the actual value, but only get the information needed from the type itself.

Minimal complete definition

epochName, epochDiffToUnix

Methods

epochName :: epoch -> String Source #

The name of this epoch

epochDiffToUnix :: epoch -> Seconds Source #

number of seconds of difference with 1st January 1970.

a negative number means that this epoch start before the unix epoch.

standard and usual epochs

data UnixEpoch Source #

Unix Epoch, starting 1st January 1970

Constructors

UnixEpoch