Portability | portable |
---|---|
Stability | provisional |
Maintainer | libraries@haskell.org |
The standard Time library, providing standard 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).
- data ClockTime = TOD Integer Integer
- getClockTime :: IO ClockTime
- data TimeDiff = TimeDiff {}
- noTimeDiff :: TimeDiff
- diffClockTimes :: ClockTime -> ClockTime -> TimeDiff
- addToClockTime :: TimeDiff -> ClockTime -> ClockTime
- normalizeTimeDiff :: TimeDiff -> TimeDiff
- timeDiffToString :: TimeDiff -> String
- formatTimeDiff :: TimeLocale -> String -> TimeDiff -> String
- data CalendarTime = CalendarTime {}
- data Month
- data Day
- toCalendarTime :: ClockTime -> IO CalendarTime
- toUTCTime :: ClockTime -> CalendarTime
- toClockTime :: CalendarTime -> ClockTime
- calendarTimeToString :: CalendarTime -> String
- formatCalendarTime :: TimeLocale -> String -> CalendarTime -> String
Clock times
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.
getClockTime :: IO ClockTimeSource
returns the current time in its internal representation.
Time differences
records the difference between two clock times in a user-readable way.
null time difference.
diffClockTimes :: ClockTime -> ClockTime -> TimeDiffSource
returns the difference between two clock
times diffClockTimes
t1 t2t1
and t2
as a TimeDiff
.
addToClockTime :: TimeDiff -> ClockTime -> ClockTimeSource
adds a time difference addToClockTime
d td
and a
clock time t
to yield a new clock time. The difference d
may be either positive or negative.
normalizeTimeDiff :: TimeDiff -> TimeDiffSource
converts a time difference to normal form.
timeDiffToString :: TimeDiff -> StringSource
formats time differences using local conventions.
formatTimeDiff :: TimeLocale -> String -> TimeDiff -> StringSource
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.
CalendarTime | |
|
A month of the year.
A day of the week.
toCalendarTime :: ClockTime -> IO CalendarTimeSource
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 -> CalendarTimeSource
converts an internal clock time into a CalendarTime
in standard
UTC format.
calendarTimeToString :: CalendarTime -> StringSource
formats calendar times using local conventions.
formatCalendarTime :: TimeLocale -> String -> CalendarTime -> StringSource
formats calendar times using local conventions and a formatting string.
The formatting string is that understood by the ISO C strftime()
function.