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
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 {}
- 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.
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 |
Instances
Show ClockTime Source # | |
Eq ClockTime Source # | |
Ord ClockTime Source # | |
Defined in System.Time |
Time differences
records the difference between two clock times in a user-readable way.
Constructors
TimeDiff | |
Instances
Read TimeDiff Source # | |
Show TimeDiff Source # | |
Eq TimeDiff Source # | |
Ord TimeDiff Source # | |
Defined in System.Time |
noTimeDiff :: TimeDiff Source #
null time difference.
diffClockTimes :: ClockTime -> ClockTime -> TimeDiff Source #
returns the difference between two clock
times diffClockTimes
t1 t2t1
and t2
as a TimeDiff
.
addToClockTime :: TimeDiff -> ClockTime -> ClockTime Source #
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 -> 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
|
Instances
Read CalendarTime Source # | |
Defined in System.Time | |
Show CalendarTime Source # | |
Defined in System.Time | |
Eq CalendarTime Source # | |
Defined in System.Time Methods (==) :: CalendarTime -> CalendarTime -> Bool Source # (/=) :: CalendarTime -> CalendarTime -> Bool Source # | |
Ord CalendarTime Source # | |
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 # |
A month of the year.
Instances
Bounded Month Source # | |
Enum Month Source # | |
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 # | |
Defined in System.Time | |
Read Month Source # | |
Show Month Source # | |
Eq Month Source # | |
Ord Month Source # | |
Defined in System.Time |
A day of the week.
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 #
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.