hourglass-0.2.9: 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 Source

A number of seconds elapsed since an epoch.

Constructors

ElapsedSince Seconds |

Instances

Eq (ElapsedSince epoch) Source |
Data epoch => Data (ElapsedSince epoch) Source |
Num (ElapsedSince epoch) Source |
Ord (ElapsedSince epoch) Source |
Read (ElapsedSince epoch) Source |
Show (ElapsedSince epoch) Source |
NFData (ElapsedSince epoch) Source |
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 |
Data epoch => Data (ElapsedSinceP epoch) Source |
Num (ElapsedSinceP e) Source |
Ord (ElapsedSinceP epoch) Source |
Read (ElapsedSinceP epoch) Source |
Show (ElapsedSinceP epoch) Source |
NFData (ElapsedSinceP e) Source |
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.

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.

Instances

Epoch WindowsEpoch Source |
Epoch UnixEpoch Source |

## standard and usual epochs

data UnixEpoch Source

Unix Epoch, starting 1st January 1970

Constructors

UnixEpoch |

Instances

Eq UnixEpoch Source |
Show UnixEpoch Source |
Epoch UnixEpoch Source |

data WindowsEpoch Source

Windows Epoch, starting 1st January 1601

Constructors

WindowsEpoch |

Instances

Eq WindowsEpoch Source |
Show WindowsEpoch Source |
Epoch WindowsEpoch Source |