old-time-1.1.0.3: Time library
Copyright(c) The University of Glasgow 2001
LicenseBSD-style (see the file libraries/old-time/LICENSE)
Maintainerlibraries@haskell.org
Stabilityprovisional
Portabilityportable
Safe HaskellTrustworthy
LanguageHaskell2010

System.Time

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

Clock times

data ClockTime #

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 # 
Instance details

Defined in System.Time

Methods

showsPrec :: Int -> ClockTime -> ShowS

show :: ClockTime -> String

showList :: [ClockTime] -> ShowS

Eq ClockTime # 
Instance details

Defined in System.Time

Methods

(==) :: ClockTime -> ClockTime -> Bool

(/=) :: ClockTime -> ClockTime -> Bool

Ord ClockTime # 
Instance details

Defined in System.Time

Methods

compare :: ClockTime -> ClockTime -> Ordering

(<) :: ClockTime -> ClockTime -> Bool

(<=) :: ClockTime -> ClockTime -> Bool

(>) :: ClockTime -> ClockTime -> Bool

(>=) :: ClockTime -> ClockTime -> Bool

max :: ClockTime -> ClockTime -> ClockTime

min :: ClockTime -> ClockTime -> ClockTime

Time differences

data TimeDiff #

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

Constructors

TimeDiff 

Fields

Instances

Instances details
Read TimeDiff # 
Instance details

Defined in System.Time

Methods

readsPrec :: Int -> ReadS TimeDiff

readList :: ReadS [TimeDiff]

readPrec :: ReadPrec TimeDiff

readListPrec :: ReadPrec [TimeDiff]

Show TimeDiff # 
Instance details

Defined in System.Time

Methods

showsPrec :: Int -> TimeDiff -> ShowS

show :: TimeDiff -> String

showList :: [TimeDiff] -> ShowS

Eq TimeDiff # 
Instance details

Defined in System.Time

Methods

(==) :: TimeDiff -> TimeDiff -> Bool

(/=) :: TimeDiff -> TimeDiff -> Bool

Ord TimeDiff # 
Instance details

Defined in System.Time

Methods

compare :: TimeDiff -> TimeDiff -> Ordering

(<) :: TimeDiff -> TimeDiff -> Bool

(<=) :: TimeDiff -> TimeDiff -> Bool

(>) :: TimeDiff -> TimeDiff -> Bool

(>=) :: TimeDiff -> TimeDiff -> Bool

max :: TimeDiff -> TimeDiff -> TimeDiff

min :: TimeDiff -> TimeDiff -> TimeDiff

noTimeDiff :: TimeDiff #

null time difference.

diffClockTimes :: ClockTime -> ClockTime -> TimeDiff #

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

addToClockTime :: TimeDiff -> ClockTime -> ClockTime #

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 #

converts a time difference to normal form.

timeDiffToString :: TimeDiff -> String #

formats time differences using local conventions.

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

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 #

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 # 
Instance details

Defined in System.Time

Methods

readsPrec :: Int -> ReadS CalendarTime

readList :: ReadS [CalendarTime]

readPrec :: ReadPrec CalendarTime

readListPrec :: ReadPrec [CalendarTime]

Show CalendarTime # 
Instance details

Defined in System.Time

Methods

showsPrec :: Int -> CalendarTime -> ShowS

show :: CalendarTime -> String

showList :: [CalendarTime] -> ShowS

Eq CalendarTime # 
Instance details

Defined in System.Time

Methods

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

(/=) :: CalendarTime -> CalendarTime -> Bool

Ord CalendarTime # 
Instance details

Defined in System.Time

data Month #

A month of the year.

Instances

Instances details
Bounded Month # 
Instance details

Defined in System.Time

Enum Month # 
Instance details

Defined in System.Time

Ix Month # 
Instance details

Defined in System.Time

Methods

range :: (Month, Month) -> [Month]

index :: (Month, Month) -> Month -> Int

unsafeIndex :: (Month, Month) -> Month -> Int

inRange :: (Month, Month) -> Month -> Bool

rangeSize :: (Month, Month) -> Int

unsafeRangeSize :: (Month, Month) -> Int

Read Month # 
Instance details

Defined in System.Time

Methods

readsPrec :: Int -> ReadS Month

readList :: ReadS [Month]

readPrec :: ReadPrec Month

readListPrec :: ReadPrec [Month]

Show Month # 
Instance details

Defined in System.Time

Methods

showsPrec :: Int -> Month -> ShowS

show :: Month -> String

showList :: [Month] -> ShowS

Eq Month # 
Instance details

Defined in System.Time

Methods

(==) :: Month -> Month -> Bool

(/=) :: Month -> Month -> Bool

Ord Month # 
Instance details

Defined in System.Time

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 Day #

A day of the week.

Instances

Instances details
Bounded Day # 
Instance details

Defined in System.Time

Methods

minBound :: Day

maxBound :: Day

Enum Day # 
Instance details

Defined in System.Time

Methods

succ :: Day -> Day

pred :: Day -> Day

toEnum :: Int -> Day

fromEnum :: Day -> Int

enumFrom :: Day -> [Day]

enumFromThen :: Day -> Day -> [Day]

enumFromTo :: Day -> Day -> [Day]

enumFromThenTo :: Day -> Day -> Day -> [Day]

Ix Day # 
Instance details

Defined in System.Time

Methods

range :: (Day, Day) -> [Day]

index :: (Day, Day) -> Day -> Int

unsafeIndex :: (Day, Day) -> Day -> Int

inRange :: (Day, Day) -> Day -> Bool

rangeSize :: (Day, Day) -> Int

unsafeRangeSize :: (Day, Day) -> Int

Read Day # 
Instance details

Defined in System.Time

Methods

readsPrec :: Int -> ReadS Day

readList :: ReadS [Day]

readPrec :: ReadPrec Day

readListPrec :: ReadPrec [Day]

Show Day # 
Instance details

Defined in System.Time

Methods

showsPrec :: Int -> Day -> ShowS

show :: Day -> String

showList :: [Day] -> ShowS

Eq Day # 
Instance details

Defined in System.Time

Methods

(==) :: Day -> Day -> Bool

(/=) :: Day -> Day -> Bool

Ord Day # 
Instance details

Defined in System.Time

Methods

compare :: Day -> Day -> Ordering

(<) :: Day -> Day -> Bool

(<=) :: Day -> Day -> Bool

(>) :: Day -> Day -> Bool

(>=) :: Day -> Day -> Bool

max :: Day -> Day -> Day

min :: Day -> Day -> Day

toCalendarTime :: ClockTime -> IO CalendarTime #

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 #

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

toClockTime :: CalendarTime -> ClockTime #

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

calendarTimeToString :: CalendarTime -> String #

formats calendar times using local conventions.

formatCalendarTime :: TimeLocale -> String -> CalendarTime -> String #

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