Time

haskell98-1.1.0.1: Compatibility with Haskell 98

Time

Synopsis

- data ClockTime
- data Month
  - = January
  - | February
  - | March
  - | April
  - | May
  - | June
  - | July
  - | August
  - | September
  - | October
  - | November
  - | December
- data Day
  - = Sunday
  - | Monday
  - | Tuesday
  - | Wednesday
  - | Thursday
  - | Friday
  - | Saturday
- data CalendarTime = CalendarTime {
  - ctYear :: Int
  - ctMonth :: Month
  - ctDay :: Int
  - ctHour :: Int
  - ctMin :: Int
  - ctSec :: Int
  - ctPicosec :: Integer
  - ctWDay :: Day
  - ctYDay :: Int
  - ctTZName :: String
  - ctTZ :: Int
  - ctIsDST :: Bool
  }
- data TimeDiff = TimeDiff {
  - tdYear :: Int
  - tdMonth :: Int
  - tdDay :: Int
  - tdHour :: Int
  - tdMin :: Int
  - tdSec :: Int
  - tdPicosec :: Integer
  }
- getClockTime :: IO ClockTime
- addToClockTime :: TimeDiff -> ClockTime -> ClockTime
- diffClockTimes :: ClockTime -> ClockTime -> TimeDiff
- toCalendarTime :: ClockTime -> IO CalendarTime
- toUTCTime :: ClockTime -> CalendarTime
- toClockTime :: CalendarTime -> ClockTime
- calendarTimeToString :: CalendarTime -> String
- formatCalendarTime :: TimeLocale -> String -> CalendarTime -> String

# Documentation

data ClockTime Source

A representation of the internal clock time. Clock times may be compared, converted to strings, or converted to an external calendar time `CalendarTime` for I/O or other manipulations.

Instances

Eq ClockTime |
Ord ClockTime |
Show ClockTime |

data Month Source

A month of the year.

Constructors

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

Instances

Bounded Month |
Enum Month |
Eq Month |
Ord Month |
Read Month |
Show Month |
Ix Month |

data Day Source

A day of the week.

Constructors

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

Instances

Bounded Day |
Enum Day |
Eq Day |
Ord Day |
Read Day |
Show Day |
Ix Day |

data CalendarTime Source

`CalendarTime` is a user-readable and manipulable representation of the internal `ClockTime` type.

Constructors

CalendarTime |
Fields ctYear :: Int Year (pre-Gregorian dates are inaccurate) ctMonth :: Month Month of the year ctDay :: Int Day of the month (1 to 31) ctHour :: Int Hour of the day (0 to 23) ctMin :: Int Minutes (0 to 59) ctSec :: Int Seconds (0 to 61, allowing for up to two leap seconds) ctPicosec :: Integer Picoseconds ctWDay :: Day Day of the week ctYDay :: Int Day of the year (0 to 364, or 365 in leap years) ctTZName :: String Name of the time zone ctTZ :: Int Variation from UTC in seconds ctIsDST :: Bool `True` if Daylight Savings Time would be in effect, and `False` otherwise

Instances

Eq CalendarTime |
Ord CalendarTime |
Read CalendarTime |
Show CalendarTime |

data TimeDiff Source

records the difference between two clock times in a user-readable way.

Constructors

TimeDiff |
Fields tdYear :: Int tdMonth :: Int tdDay :: Int tdHour :: Int tdMin :: Int tdSec :: Int tdPicosec :: Integer

Instances

Eq TimeDiff |
Ord TimeDiff |
Read TimeDiff |
Show TimeDiff |

getClockTime :: IO ClockTime Source

addToClockTime :: TimeDiff -> ClockTime -> ClockTime Source

``addToClockTime` d t` adds a time difference `d` and a clock time `t` to yield a new clock time. The difference `d` may be either positive or negative.

diffClockTimes :: ClockTime -> ClockTime -> TimeDiff Source

``diffClockTimes` t1 t2` returns the difference between two clock times `t1` and `t2` as a `TimeDiff`.

toCalendarTime :: ClockTime -> IO CalendarTime Source

converts an internal clock time to a local time, modified by the timezone and daylight savings time settings in force at the time of conversion. Because of this dependence on the local environment, `toCalendarTime` is in the `IO` monad.

toUTCTime :: ClockTime -> CalendarTime Source

converts an internal clock time into a `CalendarTime` in standard UTC format.

toClockTime :: CalendarTime -> ClockTime Source

converts a `CalendarTime` into the corresponding internal `ClockTime`, ignoring the contents of the `ctWDay`, `ctYDay`, `ctTZName` and `ctIsDST` fields.

calendarTimeToString :: CalendarTime -> String Source

formats calendar times using local conventions.

formatCalendarTime :: TimeLocale -> String -> CalendarTime -> String Source

formats calendar times using local conventions and a formatting string. The formatting string is that understood by the ISO C `strftime()` function.