old-time-1.1.0.3: Time library

Copyright | (c) The University of Glasgow 2001
License | BSD-style (see the file libraries/old-time/LICENSE)
Maintainer | libraries@haskell.org
Stability | provisional
Portability | portable
Safe Haskell | Trustworthy
Language | Haskell2010

System.Time

Contents

- Clock times
- Time differences
- Calendar times

Description

The standard time library from Haskell 98. This library is deprecated, please look at `Data.Time` in the `time` package instead.

System.Time provides functionality for clock times, including timezone information (i.e, the functionality of "`time.h`", adapted to the Haskell environment). It follows RFC 1129 in its use of Coordinated Universal Time (UTC).

Synopsis

- data ClockTime = TOD Integer Integer
- getClockTime :: IO ClockTime
- data TimeDiff = TimeDiff {
  - tdYear :: Int
  - tdMonth :: Int
  - tdDay :: Int
  - tdHour :: Int
  - tdMin :: Int
  - tdSec :: Int
  - tdPicosec :: Integer
  }
- noTimeDiff :: TimeDiff
- diffClockTimes :: ClockTime -> ClockTime -> TimeDiff
- addToClockTime :: TimeDiff -> ClockTime -> ClockTime
- normalizeTimeDiff :: TimeDiff -> TimeDiff
- timeDiffToString :: TimeDiff -> String
- formatTimeDiff :: TimeLocale -> String -> TimeDiff -> String
- 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 Month
  - = January
  - | February
  - | March
  - | April
  - | May
  - | June
  - | July
  - | August
  - | September
  - | October
  - | November
  - | December
- data Day
  - = Sunday
  - | Monday
  - | Tuesday
  - | Wednesday
  - | Thursday
  - | Friday
  - | Saturday
- toCalendarTime :: ClockTime -> IO CalendarTime
- toUTCTime :: ClockTime -> CalendarTime
- toClockTime :: CalendarTime -> ClockTime
- calendarTimeToString :: CalendarTime -> String
- formatCalendarTime :: TimeLocale -> String -> CalendarTime -> String

# Clock times

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.

Constructors

TOD Integer Integer | Construct a clock time. The arguments are a number of seconds since 00:00:00 (UTC) on 1 January 1970, and an additional number of picoseconds. In Haskell 98, the `ClockTime` type is abstract.

#### Instances

Instances details

Show ClockTime Source # |
Instance details Defined in System.Time Methods showsPrec :: Int -> ClockTime -> ShowS Source # show :: ClockTime -> String Source # showList :: [ClockTime] -> ShowS Source #
Eq ClockTime Source # |
Instance details Defined in System.Time Methods (==) :: ClockTime -> ClockTime -> Bool Source # (/=) :: ClockTime -> ClockTime -> Bool Source #
Ord ClockTime Source # |
Instance details Defined in System.Time Methods compare :: ClockTime -> ClockTime -> Ordering Source # (<) :: ClockTime -> ClockTime -> Bool Source # (<=) :: ClockTime -> ClockTime -> Bool Source # (>) :: ClockTime -> ClockTime -> Bool Source # (>=) :: ClockTime -> ClockTime -> Bool Source # max :: ClockTime -> ClockTime -> ClockTime Source # min :: ClockTime -> ClockTime -> ClockTime Source #

getClockTime :: IO ClockTime Source #

# Time differences

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

Instances details

Read TimeDiff Source # |
Instance details Defined in System.Time Methods readsPrec :: Int -> ReadS TimeDiff Source # readList :: ReadS [TimeDiff] Source # readPrec :: ReadPrec TimeDiff Source # readListPrec :: ReadPrec [TimeDiff] Source #
Show TimeDiff Source # |
Instance details Defined in System.Time Methods showsPrec :: Int -> TimeDiff -> ShowS Source # show :: TimeDiff -> String Source # showList :: [TimeDiff] -> ShowS Source #
Eq TimeDiff Source # |
Instance details Defined in System.Time Methods (==) :: TimeDiff -> TimeDiff -> Bool Source # (/=) :: TimeDiff -> TimeDiff -> Bool Source #
Ord TimeDiff Source # |
Instance details Defined in System.Time Methods compare :: TimeDiff -> TimeDiff -> Ordering Source # (<) :: TimeDiff -> TimeDiff -> Bool Source # (<=) :: TimeDiff -> TimeDiff -> Bool Source # (>) :: TimeDiff -> TimeDiff -> Bool Source # (>=) :: TimeDiff -> TimeDiff -> Bool Source # max :: TimeDiff -> TimeDiff -> TimeDiff Source # min :: TimeDiff -> TimeDiff -> TimeDiff Source #

noTimeDiff :: TimeDiff Source #

null time difference.

diffClockTimes :: ClockTime -> ClockTime -> TimeDiff Source #

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

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.

normalizeTimeDiff :: TimeDiff -> TimeDiff Source #

converts a time difference to normal form.

timeDiffToString :: TimeDiff -> String Source #

formats time differences using local conventions.

formatTimeDiff :: TimeLocale -> String -> TimeDiff -> String Source #

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

# Calendar times

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

Instances details

Read CalendarTime Source # |
Instance details Defined in System.Time Methods readsPrec :: Int -> ReadS CalendarTime Source # readList :: ReadS [CalendarTime] Source # readPrec :: ReadPrec CalendarTime Source # readListPrec :: ReadPrec [CalendarTime] Source #
Show CalendarTime Source # |
Instance details Defined in System.Time Methods showsPrec :: Int -> CalendarTime -> ShowS Source # show :: CalendarTime -> String Source # showList :: [CalendarTime] -> ShowS Source #
Eq CalendarTime Source # |
Instance details Defined in System.Time Methods (==) :: CalendarTime -> CalendarTime -> Bool Source # (/=) :: CalendarTime -> CalendarTime -> Bool Source #
Ord CalendarTime Source # |

Instance details

Defined in System.Time

Methods

compare :: CalendarTime -> CalendarTime -> Ordering Source #

(<) :: CalendarTime -> CalendarTime -> Bool Source #

(<=) :: CalendarTime -> CalendarTime -> Bool Source #

(>) :: CalendarTime -> CalendarTime -> Bool Source #

(>=) :: CalendarTime -> CalendarTime -> Bool Source #

max :: CalendarTime -> CalendarTime -> CalendarTime Source #

min :: CalendarTime -> CalendarTime -> CalendarTime Source #

data Month Source #

A month of the year.

Constructors

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

#### Instances

Instances details

Bounded Month Source # |
Instance details Defined in System.Time Methods minBound :: Month Source # maxBound :: Month Source #
Enum Month Source # |
Instance details Defined in System.Time Methods succ :: Month -> Month Source # pred :: Month -> Month Source # toEnum :: Int -> Month Source # fromEnum :: Month -> Int Source # enumFrom :: Month -> [Month] Source # enumFromThen :: Month -> Month -> [Month] Source # enumFromTo :: Month -> Month -> [Month] Source # enumFromThenTo :: Month -> Month -> Month -> [Month] Source #
Ix Month Source # |
Instance details Defined in System.Time Methods range :: (Month, Month) -> [Month] Source # index :: (Month, Month) -> Month -> Int Source # unsafeIndex :: (Month, Month) -> Month -> Int Source # inRange :: (Month, Month) -> Month -> Bool Source # rangeSize :: (Month, Month) -> Int Source # unsafeRangeSize :: (Month, Month) -> Int Source #
Read Month Source # |
Instance details Defined in System.Time Methods readsPrec :: Int -> ReadS Month Source # readList :: ReadS [Month] Source # readPrec :: ReadPrec Month Source # readListPrec :: ReadPrec [Month] Source #
Show Month Source # |
Instance details Defined in System.Time Methods showsPrec :: Int -> Month -> ShowS Source # show :: Month -> String Source # showList :: [Month] -> ShowS Source #
Eq Month Source # |
Instance details Defined in System.Time Methods (==) :: Month -> Month -> Bool Source # (/=) :: Month -> Month -> Bool Source #
Ord Month Source # |
Instance details Defined in System.Time Methods compare :: Month -> Month -> Ordering Source # (<) :: Month -> Month -> Bool Source # (<=) :: Month -> Month -> Bool Source # (>) :: Month -> Month -> Bool Source # (>=) :: Month -> Month -> Bool Source # max :: Month -> Month -> Month Source # min :: Month -> Month -> Month Source #

data Day Source #

A day of the week.

Constructors

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

#### Instances

Instances details

Bounded Day Source # |
Instance details Defined in System.Time Methods minBound :: Day Source # maxBound :: Day Source #
Enum Day Source # |
Instance details Defined in System.Time Methods succ :: Day -> Day Source # pred :: Day -> Day Source # toEnum :: Int -> Day Source # fromEnum :: Day -> Int Source # enumFrom :: Day -> [Day] Source # enumFromThen :: Day -> Day -> [Day] Source # enumFromTo :: Day -> Day -> [Day] Source # enumFromThenTo :: Day -> Day -> Day -> [Day] Source #
Ix Day Source # |
Instance details Defined in System.Time Methods range :: (Day, Day) -> [Day] Source # index :: (Day, Day) -> Day -> Int Source # unsafeIndex :: (Day, Day) -> Day -> Int Source # inRange :: (Day, Day) -> Day -> Bool Source # rangeSize :: (Day, Day) -> Int Source # unsafeRangeSize :: (Day, Day) -> Int Source #
Read Day Source # |
Instance details Defined in System.Time Methods readsPrec :: Int -> ReadS Day Source # readList :: ReadS [Day] Source # readPrec :: ReadPrec Day Source # readListPrec :: ReadPrec [Day] Source #
Show Day Source # |
Instance details Defined in System.Time Methods showsPrec :: Int -> Day -> ShowS Source # show :: Day -> String Source # showList :: [Day] -> ShowS Source #
Eq Day Source # |
Instance details Defined in System.Time Methods (==) :: Day -> Day -> Bool Source # (/=) :: Day -> Day -> Bool Source #
Ord Day Source # |
Instance details Defined in System.Time Methods compare :: Day -> Day -> Ordering Source # (<) :: Day -> Day -> Bool Source # (<=) :: Day -> Day -> Bool Source # (>) :: Day -> Day -> Bool Source # (>=) :: Day -> Day -> Bool Source # max :: Day -> Day -> Day Source # min :: Day -> Day -> Day Source #

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.