hourglass-0.2.8: simple performant time related library

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Stability | experimental
Portability | unknown
Safe Haskell | None
Language | Haskell2010

Data.Hourglass.Epoch

Contents

- computer time tracking with various epoch
- Epoch
  - standard and usual epochs

Description

Epoch tracking

Synopsis

- newtype ElapsedSince epoch = ElapsedSince Seconds
- data ElapsedSinceP epoch = ElapsedSinceP !(ElapsedSince epoch) !NanoSeconds
- class Epoch epoch where
  - epochName :: epoch -> String
  - epochDiffToUnix :: epoch -> Seconds
- data UnixEpoch = UnixEpoch
- data WindowsEpoch = WindowsEpoch

# computer time tracking with various epoch

newtype ElapsedSince epoch

A number of seconds elapsed since an epoch.

Constructors

ElapsedSince Seconds |

Instances

Eq (ElapsedSince epoch) |
Data epoch => Data (ElapsedSince epoch) |
Num (ElapsedSince epoch) |
Ord (ElapsedSince epoch) |
Read (ElapsedSince epoch) |
Show (ElapsedSince epoch) |
NFData (ElapsedSince epoch) |
Epoch epoch => Time (ElapsedSince epoch) |
Epoch epoch => Timeable (ElapsedSince epoch) |
Typeable (* -> *) ElapsedSince |

data ElapsedSinceP epoch

A number of seconds and nanoseconds elapsed since an epoch.

Constructors

ElapsedSinceP !(ElapsedSince epoch) !NanoSeconds |

Instances

Eq (ElapsedSinceP epoch) |
Data epoch => Data (ElapsedSinceP epoch) |
Num (ElapsedSinceP e) |
Ord (ElapsedSinceP epoch) |
Read (ElapsedSinceP epoch) |
Show (ElapsedSinceP epoch) |
NFData (ElapsedSinceP e) |
Epoch epoch => Time (ElapsedSinceP epoch) |
Epoch epoch => Timeable (ElapsedSinceP epoch) |
Typeable (* -> *) ElapsedSinceP |

# Epoch

class Epoch epoch where

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.

Methods

epochName :: epoch -> String

The name of this epoch

epochDiffToUnix :: epoch -> Seconds

number of seconds of difference with 1st January 1970.

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

Instances

Epoch WindowsEpoch |
Epoch UnixEpoch |

## standard and usual epochs

data UnixEpoch

Unix Epoch, starting 1st January 1970

Constructors

UnixEpoch |

Instances

Eq UnixEpoch |
Show UnixEpoch |
Epoch UnixEpoch |

data WindowsEpoch

Windows Epoch, starting 1st January 1601

Constructors

WindowsEpoch |

Instances

Eq WindowsEpoch |
Show WindowsEpoch |
Epoch WindowsEpoch |