Time.Types

hourglass-0.2.12: simple performant time related library

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Safe Haskell | Safe-Inferred
Language | Haskell2010

Time.Types

Contents

- Time units
- Time enumeration
- Timezone
- Computer friendly format
  - Unix elapsed
- Human friendly format
  - Calendar time

Description

Basic times units and types.

While pratically some units could hold infinite values, for practical and efficient purpose they are limited to int64 types for seconds and int types for years.

Most units use the unix epoch referential, but by no means reduce portability. the unix referential works under the Windows platform or any other platforms.

Synopsis

- newtype NanoSeconds = NanoSeconds Int64
- newtype Seconds = Seconds Int64
- newtype Minutes = Minutes Int64
- newtype Hours = Hours Int64
- class TimeInterval i where
  - toSeconds :: i -> Seconds
  - fromSeconds :: Seconds -> (i, Seconds)
- data Month
  - = January
  - | February
  - | March
  - | April
  - | May
  - | June
  - | July
  - | August
  - | September
  - | October
  - | November
  - | December
- data WeekDay
  - = Sunday
  - | Monday
  - | Tuesday
  - | Wednesday
  - | Thursday
  - | Friday
  - | Saturday
- newtype TimezoneOffset = TimezoneOffset {
  - timezoneOffsetToMinutes :: Int
  }
- timezoneOffsetToSeconds :: TimezoneOffset -> Seconds
- timezone_UTC :: TimezoneOffset
- newtype Elapsed = Elapsed Seconds
- data ElapsedP = ElapsedP !Elapsed !NanoSeconds
- data Date = Date {
  - dateYear :: !Int
  - dateMonth :: !Month
  - dateDay :: !Int
  }
- data TimeOfDay = TimeOfDay {
  - todHour :: !Hours
  - todMin :: !Minutes
  - todSec :: !Seconds
  - todNSec :: !NanoSeconds
  }
- data DateTime = DateTime {
  - dtDate :: Date
  - dtTime :: TimeOfDay
  }

# Time units

newtype NanoSeconds #

Nanoseconds

Constructors

NanoSeconds Int64 |

#### Instances

Instances details

Data NanoSeconds # |
Instance details Defined in Time.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> NanoSeconds -> c NanoSeconds gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c NanoSeconds toConstr :: NanoSeconds -> Constr dataTypeOf :: NanoSeconds -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c NanoSeconds) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NanoSeconds) gmapT :: (forall b. Data b => b -> b) -> NanoSeconds -> NanoSeconds gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> NanoSeconds -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> NanoSeconds -> r gmapQ :: (forall d. Data d => d -> u) -> NanoSeconds -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> NanoSeconds -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> NanoSeconds -> m NanoSeconds gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> NanoSeconds -> m NanoSeconds gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> NanoSeconds -> m NanoSeconds
Num NanoSeconds # |
Instance details Defined in Time.Types Methods (+) :: NanoSeconds -> NanoSeconds -> NanoSeconds (-) :: NanoSeconds -> NanoSeconds -> NanoSeconds (*) :: NanoSeconds -> NanoSeconds -> NanoSeconds negate :: NanoSeconds -> NanoSeconds abs :: NanoSeconds -> NanoSeconds signum :: NanoSeconds -> NanoSeconds fromInteger :: Integer -> NanoSeconds
Read NanoSeconds # |
Instance details Defined in Time.Types Methods readsPrec :: Int -> ReadS NanoSeconds readList :: ReadS [NanoSeconds] readPrec :: ReadPrec NanoSeconds readListPrec :: ReadPrec [NanoSeconds]
Show NanoSeconds # |
Instance details Defined in Time.Types Methods showsPrec :: Int -> NanoSeconds -> ShowS show :: NanoSeconds -> String showList :: [NanoSeconds] -> ShowS
NFData NanoSeconds # |
Instance details Defined in Time.Types Methods rnf :: NanoSeconds -> ()
Eq NanoSeconds # |
Instance details Defined in Time.Types Methods (==) :: NanoSeconds -> NanoSeconds -> Bool (/=) :: NanoSeconds -> NanoSeconds -> Bool
Ord NanoSeconds # |
Instance details Defined in Time.Types Methods compare :: NanoSeconds -> NanoSeconds -> Ordering (<) :: NanoSeconds -> NanoSeconds -> Bool (<=) :: NanoSeconds -> NanoSeconds -> Bool (>) :: NanoSeconds -> NanoSeconds -> Bool (>=) :: NanoSeconds -> NanoSeconds -> Bool max :: NanoSeconds -> NanoSeconds -> NanoSeconds min :: NanoSeconds -> NanoSeconds -> NanoSeconds
TimeInterval NanoSeconds # |
Instance details Defined in Time.Types Methods toSeconds :: NanoSeconds -> Seconds # fromSeconds :: Seconds -> (NanoSeconds, Seconds) #

newtype Seconds #

Number of seconds without a referential.

Can hold a number between [-2^63,2^63-1], which should be good for some billions of years.

However, because of limitation in the calendar conversion currently used, seconds should be in the range [-2^55,2^55-1], which is good for only 1 billion of year.

Constructors

Seconds Int64 |

#### Instances

Instances details

Data Seconds # |
Instance details Defined in Time.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Seconds -> c Seconds gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Seconds toConstr :: Seconds -> Constr dataTypeOf :: Seconds -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Seconds) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Seconds) gmapT :: (forall b. Data b => b -> b) -> Seconds -> Seconds gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Seconds -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Seconds -> r gmapQ :: (forall d. Data d => d -> u) -> Seconds -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> Seconds -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> Seconds -> m Seconds gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Seconds -> m Seconds gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Seconds -> m Seconds
Enum Seconds # |
Instance details Defined in Time.Types Methods succ :: Seconds -> Seconds pred :: Seconds -> Seconds toEnum :: Int -> Seconds fromEnum :: Seconds -> Int enumFrom :: Seconds -> [Seconds] enumFromThen :: Seconds -> Seconds -> [Seconds] enumFromTo :: Seconds -> Seconds -> [Seconds] enumFromThenTo :: Seconds -> Seconds -> Seconds -> [Seconds]
Num Seconds # |
Instance details Defined in Time.Types Methods (+) :: Seconds -> Seconds -> Seconds (-) :: Seconds -> Seconds -> Seconds (*) :: Seconds -> Seconds -> Seconds negate :: Seconds -> Seconds abs :: Seconds -> Seconds signum :: Seconds -> Seconds fromInteger :: Integer -> Seconds
Read Seconds # |
Instance details Defined in Time.Types Methods readsPrec :: Int -> ReadS Seconds readList :: ReadS [Seconds] readPrec :: ReadPrec Seconds readListPrec :: ReadPrec [Seconds]
Integral Seconds # |
Instance details Defined in Time.Types Methods quot :: Seconds -> Seconds -> Seconds rem :: Seconds -> Seconds -> Seconds div :: Seconds -> Seconds -> Seconds mod :: Seconds -> Seconds -> Seconds quotRem :: Seconds -> Seconds -> (Seconds, Seconds) divMod :: Seconds -> Seconds -> (Seconds, Seconds) toInteger :: Seconds -> Integer
Real Seconds # |
Instance details Defined in Time.Types Methods toRational :: Seconds -> Rational
Show Seconds # |
Instance details Defined in Time.Types Methods showsPrec :: Int -> Seconds -> ShowS show :: Seconds -> String showList :: [Seconds] -> ShowS
NFData Seconds # |
Instance details Defined in Time.Types Methods rnf :: Seconds -> ()
Eq Seconds # |
Instance details Defined in Time.Types Methods (==) :: Seconds -> Seconds -> Bool (/=) :: Seconds -> Seconds -> Bool
Ord Seconds # |
Instance details Defined in Time.Types Methods compare :: Seconds -> Seconds -> Ordering (<) :: Seconds -> Seconds -> Bool (<=) :: Seconds -> Seconds -> Bool (>) :: Seconds -> Seconds -> Bool (>=) :: Seconds -> Seconds -> Bool max :: Seconds -> Seconds -> Seconds min :: Seconds -> Seconds -> Seconds
TimeInterval Seconds # |
Instance details Defined in Time.Types Methods toSeconds :: Seconds -> Seconds # fromSeconds :: Seconds -> (Seconds, Seconds) #

newtype Minutes #

Number of minutes without a referential.

Constructors

Minutes Int64 |

#### Instances

Instances details

Data Minutes # |
Instance details Defined in Time.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Minutes -> c Minutes gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Minutes toConstr :: Minutes -> Constr dataTypeOf :: Minutes -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Minutes) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Minutes) gmapT :: (forall b. Data b => b -> b) -> Minutes -> Minutes gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Minutes -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Minutes -> r gmapQ :: (forall d. Data d => d -> u) -> Minutes -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> Minutes -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> Minutes -> m Minutes gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Minutes -> m Minutes gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Minutes -> m Minutes
Enum Minutes # |
Instance details Defined in Time.Types Methods succ :: Minutes -> Minutes pred :: Minutes -> Minutes toEnum :: Int -> Minutes fromEnum :: Minutes -> Int enumFrom :: Minutes -> [Minutes] enumFromThen :: Minutes -> Minutes -> [Minutes] enumFromTo :: Minutes -> Minutes -> [Minutes] enumFromThenTo :: Minutes -> Minutes -> Minutes -> [Minutes]
Num Minutes # |
Instance details Defined in Time.Types Methods (+) :: Minutes -> Minutes -> Minutes (-) :: Minutes -> Minutes -> Minutes (*) :: Minutes -> Minutes -> Minutes negate :: Minutes -> Minutes abs :: Minutes -> Minutes signum :: Minutes -> Minutes fromInteger :: Integer -> Minutes
Read Minutes # |
Instance details Defined in Time.Types Methods readsPrec :: Int -> ReadS Minutes readList :: ReadS [Minutes] readPrec :: ReadPrec Minutes readListPrec :: ReadPrec [Minutes]
Integral Minutes # |
Instance details Defined in Time.Types Methods quot :: Minutes -> Minutes -> Minutes rem :: Minutes -> Minutes -> Minutes div :: Minutes -> Minutes -> Minutes mod :: Minutes -> Minutes -> Minutes quotRem :: Minutes -> Minutes -> (Minutes, Minutes) divMod :: Minutes -> Minutes -> (Minutes, Minutes) toInteger :: Minutes -> Integer
Real Minutes # |
Instance details Defined in Time.Types Methods toRational :: Minutes -> Rational
Show Minutes # |
Instance details Defined in Time.Types Methods showsPrec :: Int -> Minutes -> ShowS show :: Minutes -> String showList :: [Minutes] -> ShowS
NFData Minutes # |
Instance details Defined in Time.Types Methods rnf :: Minutes -> ()
Eq Minutes # |
Instance details Defined in Time.Types Methods (==) :: Minutes -> Minutes -> Bool (/=) :: Minutes -> Minutes -> Bool
Ord Minutes # |
Instance details Defined in Time.Types Methods compare :: Minutes -> Minutes -> Ordering (<) :: Minutes -> Minutes -> Bool (<=) :: Minutes -> Minutes -> Bool (>) :: Minutes -> Minutes -> Bool (>=) :: Minutes -> Minutes -> Bool max :: Minutes -> Minutes -> Minutes min :: Minutes -> Minutes -> Minutes
TimeInterval Minutes # |
Instance details Defined in Time.Types Methods toSeconds :: Minutes -> Seconds # fromSeconds :: Seconds -> (Minutes, Seconds) #

newtype Hours #

Number of hours without a referential.

Constructors

Hours Int64 |

#### Instances

Instances details

Data Hours # |
Instance details Defined in Time.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Hours -> c Hours gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Hours toConstr :: Hours -> Constr dataTypeOf :: Hours -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Hours) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Hours) gmapT :: (forall b. Data b => b -> b) -> Hours -> Hours gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Hours -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Hours -> r gmapQ :: (forall d. Data d => d -> u) -> Hours -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> Hours -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> Hours -> m Hours gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Hours -> m Hours gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Hours -> m Hours
Enum Hours # |
Instance details Defined in Time.Types Methods succ :: Hours -> Hours pred :: Hours -> Hours toEnum :: Int -> Hours fromEnum :: Hours -> Int enumFrom :: Hours -> [Hours] enumFromThen :: Hours -> Hours -> [Hours] enumFromTo :: Hours -> Hours -> [Hours] enumFromThenTo :: Hours -> Hours -> Hours -> [Hours]
Num Hours # |
Instance details Defined in Time.Types Methods (+) :: Hours -> Hours -> Hours (-) :: Hours -> Hours -> Hours (*) :: Hours -> Hours -> Hours negate :: Hours -> Hours abs :: Hours -> Hours signum :: Hours -> Hours fromInteger :: Integer -> Hours
Read Hours # |
Instance details Defined in Time.Types Methods readsPrec :: Int -> ReadS Hours readList :: ReadS [Hours] readPrec :: ReadPrec Hours readListPrec :: ReadPrec [Hours]
Integral Hours # |
Instance details Defined in Time.Types Methods quot :: Hours -> Hours -> Hours rem :: Hours -> Hours -> Hours div :: Hours -> Hours -> Hours mod :: Hours -> Hours -> Hours quotRem :: Hours -> Hours -> (Hours, Hours) divMod :: Hours -> Hours -> (Hours, Hours) toInteger :: Hours -> Integer
Real Hours # |
Instance details Defined in Time.Types Methods toRational :: Hours -> Rational
Show Hours # |
Instance details Defined in Time.Types Methods showsPrec :: Int -> Hours -> ShowS show :: Hours -> String showList :: [Hours] -> ShowS
NFData Hours # |
Instance details Defined in Time.Types Methods rnf :: Hours -> ()
Eq Hours # |
Instance details Defined in Time.Types Methods (==) :: Hours -> Hours -> Bool (/=) :: Hours -> Hours -> Bool
Ord Hours # |
Instance details Defined in Time.Types Methods compare :: Hours -> Hours -> Ordering (<) :: Hours -> Hours -> Bool (<=) :: Hours -> Hours -> Bool (>) :: Hours -> Hours -> Bool (>=) :: Hours -> Hours -> Bool max :: Hours -> Hours -> Hours min :: Hours -> Hours -> Hours
TimeInterval Hours # |
Instance details Defined in Time.Types Methods toSeconds :: Hours -> Seconds # fromSeconds :: Seconds -> (Hours, Seconds) #

class TimeInterval i where #

Represent any time interval that has an equivalent value to a number of seconds.

Methods

toSeconds :: i -> Seconds #

fromSeconds :: Seconds -> (i, Seconds) #

#### Instances

Instances details

TimeInterval Duration # |
Instance details Defined in Data.Hourglass.Diff Methods toSeconds :: Duration -> Seconds # fromSeconds :: Seconds -> (Duration, Seconds) #
TimeInterval Hours # |
Instance details Defined in Time.Types Methods toSeconds :: Hours -> Seconds # fromSeconds :: Seconds -> (Hours, Seconds) #
TimeInterval Minutes # |
Instance details Defined in Time.Types Methods toSeconds :: Minutes -> Seconds # fromSeconds :: Seconds -> (Minutes, Seconds) #
TimeInterval NanoSeconds # |
Instance details Defined in Time.Types Methods toSeconds :: NanoSeconds -> Seconds # fromSeconds :: Seconds -> (NanoSeconds, Seconds) #
TimeInterval Seconds # |
Instance details Defined in Time.Types Methods toSeconds :: Seconds -> Seconds # fromSeconds :: Seconds -> (Seconds, Seconds) #

# Time enumeration

data Month #

Month of the year

Constructors

January |
February |
March |
April |
May |
June |
July |
August |
September |
October |
November |
December |

#### Instances

Instances details

Data Month # |
Instance details Defined in Time.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Month -> c Month gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Month toConstr :: Month -> Constr dataTypeOf :: Month -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Month) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Month) gmapT :: (forall b. Data b => b -> b) -> Month -> Month gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Month -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Month -> r gmapQ :: (forall d. Data d => d -> u) -> Month -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> Month -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> Month -> m Month gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Month -> m Month gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Month -> m Month
Bounded Month # |
Instance details Defined in Time.Types Methods minBound :: Month maxBound :: Month
Enum Month # |
Instance details Defined in Time.Types Methods succ :: Month -> Month pred :: Month -> Month toEnum :: Int -> Month fromEnum :: Month -> Int enumFrom :: Month -> [Month] enumFromThen :: Month -> Month -> [Month] enumFromTo :: Month -> Month -> [Month] enumFromThenTo :: Month -> Month -> Month -> [Month]
Read Month # |
Instance details Defined in Time.Types Methods readsPrec :: Int -> ReadS Month readList :: ReadS [Month] readPrec :: ReadPrec Month readListPrec :: ReadPrec [Month]
Show Month # |
Instance details Defined in Time.Types Methods showsPrec :: Int -> Month -> ShowS show :: Month -> String showList :: [Month] -> ShowS
Eq Month # |
Instance details Defined in Time.Types Methods (==) :: Month -> Month -> Bool (/=) :: Month -> Month -> Bool
Ord Month # |
Instance details Defined in Time.Types Methods compare :: Month -> Month -> Ordering (<) :: Month -> Month -> Bool (<=) :: Month -> Month -> Bool (>) :: Month -> Month -> Bool (>=) :: Month -> Month -> Bool max :: Month -> Month -> Month min :: Month -> Month -> Month

data WeekDay #

Day of the week

the enumeration starts on Sunday.

Constructors

Sunday |
Monday |
Tuesday |
Wednesday |
Thursday |
Friday |
Saturday |

#### Instances

Instances details

Data WeekDay # |
Instance details Defined in Time.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> WeekDay -> c WeekDay gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c WeekDay toConstr :: WeekDay -> Constr dataTypeOf :: WeekDay -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c WeekDay) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c WeekDay) gmapT :: (forall b. Data b => b -> b) -> WeekDay -> WeekDay gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> WeekDay -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> WeekDay -> r gmapQ :: (forall d. Data d => d -> u) -> WeekDay -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> WeekDay -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> WeekDay -> m WeekDay gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> WeekDay -> m WeekDay gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> WeekDay -> m WeekDay
Bounded WeekDay # |
Instance details Defined in Time.Types Methods minBound :: WeekDay maxBound :: WeekDay
Enum WeekDay # |
Instance details Defined in Time.Types Methods succ :: WeekDay -> WeekDay pred :: WeekDay -> WeekDay toEnum :: Int -> WeekDay fromEnum :: WeekDay -> Int enumFrom :: WeekDay -> [WeekDay] enumFromThen :: WeekDay -> WeekDay -> [WeekDay] enumFromTo :: WeekDay -> WeekDay -> [WeekDay] enumFromThenTo :: WeekDay -> WeekDay -> WeekDay -> [WeekDay]
Read WeekDay # |
Instance details Defined in Time.Types Methods readsPrec :: Int -> ReadS WeekDay readList :: ReadS [WeekDay] readPrec :: ReadPrec WeekDay readListPrec :: ReadPrec [WeekDay]
Show WeekDay # |
Instance details Defined in Time.Types Methods showsPrec :: Int -> WeekDay -> ShowS show :: WeekDay -> String showList :: [WeekDay] -> ShowS
Eq WeekDay # |
Instance details Defined in Time.Types Methods (==) :: WeekDay -> WeekDay -> Bool (/=) :: WeekDay -> WeekDay -> Bool
Ord WeekDay # |
Instance details Defined in Time.Types Methods compare :: WeekDay -> WeekDay -> Ordering (<) :: WeekDay -> WeekDay -> Bool (<=) :: WeekDay -> WeekDay -> Bool (>) :: WeekDay -> WeekDay -> Bool (>=) :: WeekDay -> WeekDay -> Bool max :: WeekDay -> WeekDay -> WeekDay min :: WeekDay -> WeekDay -> WeekDay

# Timezone

newtype TimezoneOffset #

Offset against UTC in minutes to obtain from UTC time, local time.

- a positive number represent a location East of UTC.
- a negative number represent a location West of UTC.

LocalTime t (-300) = t represent a time at UTC-5 LocalTime t (+480) = t represent a time at UTC+8

should be between -11H and +14H

Example: in AUSEDT (UTC+1000 with daylight = UTC+1100), local time is 15:47; Thus, UTC time is 04:47, and TimezoneOffset is +660 (minutes)

Constructors

TimezoneOffset |
Fields timezoneOffsetToMinutes :: Int return the number of minutes

#### Instances

Instances details

Data TimezoneOffset # |
Instance details Defined in Time.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TimezoneOffset -> c TimezoneOffset gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TimezoneOffset toConstr :: TimezoneOffset -> Constr dataTypeOf :: TimezoneOffset -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TimezoneOffset) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TimezoneOffset) gmapT :: (forall b. Data b => b -> b) -> TimezoneOffset -> TimezoneOffset gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TimezoneOffset -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TimezoneOffset -> r gmapQ :: (forall d. Data d => d -> u) -> TimezoneOffset -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> TimezoneOffset -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> TimezoneOffset -> m TimezoneOffset gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TimezoneOffset -> m TimezoneOffset gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TimezoneOffset -> m TimezoneOffset
Show TimezoneOffset # |
Instance details Defined in Time.Types Methods showsPrec :: Int -> TimezoneOffset -> ShowS show :: TimezoneOffset -> String showList :: [TimezoneOffset] -> ShowS
NFData TimezoneOffset # |
Instance details Defined in Time.Types Methods rnf :: TimezoneOffset -> ()
Eq TimezoneOffset # |
Instance details Defined in Time.Types Methods (==) :: TimezoneOffset -> TimezoneOffset -> Bool (/=) :: TimezoneOffset -> TimezoneOffset -> Bool
Ord TimezoneOffset # |
Instance details Defined in Time.Types Methods compare :: TimezoneOffset -> TimezoneOffset -> Ordering (<) :: TimezoneOffset -> TimezoneOffset -> Bool (<=) :: TimezoneOffset -> TimezoneOffset -> Bool (>) :: TimezoneOffset -> TimezoneOffset -> Bool (>=) :: TimezoneOffset -> TimezoneOffset -> Bool max :: TimezoneOffset -> TimezoneOffset -> TimezoneOffset min :: TimezoneOffset -> TimezoneOffset -> TimezoneOffset

timezoneOffsetToSeconds :: TimezoneOffset -> Seconds #

Return the number of seconds associated with a timezone

timezone_UTC :: TimezoneOffset #

The UTC timezone. offset of 0

# Computer friendly format

## Unix elapsed

newtype Elapsed #

A number of seconds elapsed since the unix epoch.

Constructors

Elapsed Seconds |

#### Instances

Instances details

Data Elapsed # |
Instance details Defined in Time.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Elapsed -> c Elapsed gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Elapsed toConstr :: Elapsed -> Constr dataTypeOf :: Elapsed -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Elapsed) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Elapsed) gmapT :: (forall b. Data b => b -> b) -> Elapsed -> Elapsed gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Elapsed -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Elapsed -> r gmapQ :: (forall d. Data d => d -> u) -> Elapsed -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> Elapsed -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> Elapsed -> m Elapsed gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Elapsed -> m Elapsed gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Elapsed -> m Elapsed
Num Elapsed # |
Instance details Defined in Time.Types Methods (+) :: Elapsed -> Elapsed -> Elapsed (-) :: Elapsed -> Elapsed -> Elapsed (*) :: Elapsed -> Elapsed -> Elapsed negate :: Elapsed -> Elapsed abs :: Elapsed -> Elapsed signum :: Elapsed -> Elapsed fromInteger :: Integer -> Elapsed
Read Elapsed # |
Instance details Defined in Time.Types Methods readsPrec :: Int -> ReadS Elapsed readList :: ReadS [Elapsed] readPrec :: ReadPrec Elapsed readListPrec :: ReadPrec [Elapsed]
Show Elapsed # |
Instance details Defined in Time.Types Methods showsPrec :: Int -> Elapsed -> ShowS show :: Elapsed -> String showList :: [Elapsed] -> ShowS
NFData Elapsed # |
Instance details Defined in Time.Types Methods rnf :: Elapsed -> ()
Eq Elapsed # |
Instance details Defined in Time.Types Methods (==) :: Elapsed -> Elapsed -> Bool (/=) :: Elapsed -> Elapsed -> Bool
Ord Elapsed # |
Instance details Defined in Time.Types Methods compare :: Elapsed -> Elapsed -> Ordering (<) :: Elapsed -> Elapsed -> Bool (<=) :: Elapsed -> Elapsed -> Bool (>) :: Elapsed -> Elapsed -> Bool (>=) :: Elapsed -> Elapsed -> Bool max :: Elapsed -> Elapsed -> Elapsed min :: Elapsed -> Elapsed -> Elapsed
Time Elapsed # |
Instance details Defined in Data.Hourglass.Time Methods timeFromElapsedP :: ElapsedP -> Elapsed # timeFromElapsed :: Elapsed -> Elapsed #
Timeable Elapsed # |
Instance details Defined in Data.Hourglass.Time Methods timeGetElapsedP :: Elapsed -> ElapsedP # timeGetElapsed :: Elapsed -> Elapsed # timeGetNanoSeconds :: Elapsed -> NanoSeconds #

data ElapsedP #

A number of seconds and nanoseconds elapsed since the unix epoch.

Constructors

ElapsedP !Elapsed !NanoSeconds |

#### Instances

Instances details

Data ElapsedP # |
Instance details Defined in Time.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ElapsedP -> c ElapsedP gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ElapsedP toConstr :: ElapsedP -> Constr dataTypeOf :: ElapsedP -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ElapsedP) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ElapsedP) gmapT :: (forall b. Data b => b -> b) -> ElapsedP -> ElapsedP gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ElapsedP -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ElapsedP -> r gmapQ :: (forall d. Data d => d -> u) -> ElapsedP -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> ElapsedP -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> ElapsedP -> m ElapsedP gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ElapsedP -> m ElapsedP gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ElapsedP -> m ElapsedP
Num ElapsedP # |
Instance details Defined in Time.Types Methods (+) :: ElapsedP -> ElapsedP -> ElapsedP (-) :: ElapsedP -> ElapsedP -> ElapsedP (*) :: ElapsedP -> ElapsedP -> ElapsedP negate :: ElapsedP -> ElapsedP abs :: ElapsedP -> ElapsedP signum :: ElapsedP -> ElapsedP fromInteger :: Integer -> ElapsedP
Read ElapsedP # |
Instance details Defined in Time.Types Methods readsPrec :: Int -> ReadS ElapsedP readList :: ReadS [ElapsedP] readPrec :: ReadPrec ElapsedP readListPrec :: ReadPrec [ElapsedP]
Real ElapsedP # |
Instance details Defined in Time.Types Methods toRational :: ElapsedP -> Rational
Show ElapsedP # |
Instance details Defined in Time.Types Methods showsPrec :: Int -> ElapsedP -> ShowS show :: ElapsedP -> String showList :: [ElapsedP] -> ShowS
NFData ElapsedP # |
Instance details Defined in Time.Types Methods rnf :: ElapsedP -> ()
Eq ElapsedP # |
Instance details Defined in Time.Types Methods (==) :: ElapsedP -> ElapsedP -> Bool (/=) :: ElapsedP -> ElapsedP -> Bool
Ord ElapsedP # |
Instance details Defined in Time.Types Methods compare :: ElapsedP -> ElapsedP -> Ordering (<) :: ElapsedP -> ElapsedP -> Bool (<=) :: ElapsedP -> ElapsedP -> Bool (>) :: ElapsedP -> ElapsedP -> Bool (>=) :: ElapsedP -> ElapsedP -> Bool max :: ElapsedP -> ElapsedP -> ElapsedP min :: ElapsedP -> ElapsedP -> ElapsedP
Time ElapsedP # |
Instance details Defined in Data.Hourglass.Time Methods timeFromElapsedP :: ElapsedP -> ElapsedP # timeFromElapsed :: Elapsed -> ElapsedP #
Timeable ElapsedP # |
Instance details Defined in Data.Hourglass.Time Methods timeGetElapsedP :: ElapsedP -> ElapsedP # timeGetElapsed :: ElapsedP -> Elapsed # timeGetNanoSeconds :: ElapsedP -> NanoSeconds #

# Human friendly format

## Calendar time

data Date #

human date representation using common calendar

Constructors

Date |
Fields dateYear :: !Int year (Common Era) dateMonth :: !Month month of the year dateDay :: !Int day of the month, between 1 to 31

#### Instances

Instances details

Data Date # |
Instance details Defined in Time.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Date -> c Date gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Date toConstr :: Date -> Constr dataTypeOf :: Date -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Date) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Date) gmapT :: (forall b. Data b => b -> b) -> Date -> Date gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Date -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Date -> r gmapQ :: (forall d. Data d => d -> u) -> Date -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> Date -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> Date -> m Date gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Date -> m Date gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Date -> m Date
Read Date # |
Instance details Defined in Time.Types Methods readsPrec :: Int -> ReadS Date readList :: ReadS [Date] readPrec :: ReadPrec Date readListPrec :: ReadPrec [Date]
Show Date # |
Instance details Defined in Time.Types Methods showsPrec :: Int -> Date -> ShowS show :: Date -> String showList :: [Date] -> ShowS
NFData Date # |
Instance details Defined in Time.Types Methods rnf :: Date -> ()
Eq Date # |
Instance details Defined in Time.Types Methods (==) :: Date -> Date -> Bool (/=) :: Date -> Date -> Bool
Ord Date # |
Instance details Defined in Time.Types Methods compare :: Date -> Date -> Ordering (<) :: Date -> Date -> Bool (<=) :: Date -> Date -> Bool (>) :: Date -> Date -> Bool (>=) :: Date -> Date -> Bool max :: Date -> Date -> Date min :: Date -> Date -> Date
Time Date # |
Instance details Defined in Data.Hourglass.Time Methods timeFromElapsedP :: ElapsedP -> Date # timeFromElapsed :: Elapsed -> Date #
Timeable Date # |
Instance details Defined in Data.Hourglass.Time Methods timeGetElapsedP :: Date -> ElapsedP # timeGetElapsed :: Date -> Elapsed # timeGetNanoSeconds :: Date -> NanoSeconds #

data TimeOfDay #

human time representation of hour, minutes, seconds in a day.

Constructors

TimeOfDay |
Fields todHour :: !Hours hours, between 0 and 23 todMin :: !Minutes minutes, between 0 and 59 todSec :: !Seconds seconds, between 0 and 59. 60 when having leap second */ todNSec :: !NanoSeconds nanoseconds, between 0 and 999999999 */

#### Instances

Instances details

Data TimeOfDay # |
Instance details Defined in Time.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TimeOfDay -> c TimeOfDay gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TimeOfDay toConstr :: TimeOfDay -> Constr dataTypeOf :: TimeOfDay -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TimeOfDay) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TimeOfDay) gmapT :: (forall b. Data b => b -> b) -> TimeOfDay -> TimeOfDay gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TimeOfDay -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TimeOfDay -> r gmapQ :: (forall d. Data d => d -> u) -> TimeOfDay -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> TimeOfDay -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> TimeOfDay -> m TimeOfDay gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TimeOfDay -> m TimeOfDay gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TimeOfDay -> m TimeOfDay
Read TimeOfDay # |
Instance details Defined in Time.Types Methods readsPrec :: Int -> ReadS TimeOfDay readList :: ReadS [TimeOfDay] readPrec :: ReadPrec TimeOfDay readListPrec :: ReadPrec [TimeOfDay]
Show TimeOfDay # |
Instance details Defined in Time.Types Methods showsPrec :: Int -> TimeOfDay -> ShowS show :: TimeOfDay -> String showList :: [TimeOfDay] -> ShowS
NFData TimeOfDay # |
Instance details Defined in Time.Types Methods rnf :: TimeOfDay -> ()
Eq TimeOfDay # |
Instance details Defined in Time.Types Methods (==) :: TimeOfDay -> TimeOfDay -> Bool (/=) :: TimeOfDay -> TimeOfDay -> Bool
Ord TimeOfDay # |
Instance details Defined in Time.Types Methods compare :: TimeOfDay -> TimeOfDay -> Ordering (<) :: TimeOfDay -> TimeOfDay -> Bool (<=) :: TimeOfDay -> TimeOfDay -> Bool (>) :: TimeOfDay -> TimeOfDay -> Bool (>=) :: TimeOfDay -> TimeOfDay -> Bool max :: TimeOfDay -> TimeOfDay -> TimeOfDay min :: TimeOfDay -> TimeOfDay -> TimeOfDay

data DateTime #

Date and Time

Constructors

DateTime |
Fields dtDate :: Date dtTime :: TimeOfDay

#### Instances

Instances details

Data DateTime # |
Instance details Defined in Time.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> DateTime -> c DateTime gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c DateTime toConstr :: DateTime -> Constr dataTypeOf :: DateTime -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c DateTime) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DateTime) gmapT :: (forall b. Data b => b -> b) -> DateTime -> DateTime gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> DateTime -> r gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> DateTime -> r gmapQ :: (forall d. Data d => d -> u) -> DateTime -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> DateTime -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> DateTime -> m DateTime gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> DateTime -> m DateTime gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> DateTime -> m DateTime
Read DateTime # |
Instance details Defined in Time.Types Methods readsPrec :: Int -> ReadS DateTime readList :: ReadS [DateTime] readPrec :: ReadPrec DateTime readListPrec :: ReadPrec [DateTime]
Show DateTime # |
Instance details Defined in Time.Types Methods showsPrec :: Int -> DateTime -> ShowS show :: DateTime -> String showList :: [DateTime] -> ShowS
NFData DateTime # |
Instance details Defined in Time.Types Methods rnf :: DateTime -> ()
Eq DateTime # |
Instance details Defined in Time.Types Methods (==) :: DateTime -> DateTime -> Bool (/=) :: DateTime -> DateTime -> Bool
Ord DateTime # |
Instance details Defined in Time.Types Methods compare :: DateTime -> DateTime -> Ordering (<) :: DateTime -> DateTime -> Bool (<=) :: DateTime -> DateTime -> Bool (>) :: DateTime -> DateTime -> Bool (>=) :: DateTime -> DateTime -> Bool max :: DateTime -> DateTime -> DateTime min :: DateTime -> DateTime -> DateTime
Time DateTime # |
Instance details Defined in Data.Hourglass.Time Methods timeFromElapsedP :: ElapsedP -> DateTime # timeFromElapsed :: Elapsed -> DateTime #
Timeable DateTime # |
Instance details Defined in Data.Hourglass.Time Methods timeGetElapsedP :: DateTime -> ElapsedP # timeGetElapsed :: DateTime -> Elapsed # timeGetNanoSeconds :: DateTime -> NanoSeconds #