module Time ( ClockTime, Month(January,February,March,April,May,June, July,August,September,October,November,December), Day(Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday), CalendarTime(CalendarTime), TimeDiff(TimeDiff), getClockTime, addToClockTime, diffClockTimes, toCalendarTime, toUTCTime, toClockTime, calendarTimeToString, formatCalendarTime ) where import Ix(Ix) import Locale(TimeLocale,defaultTimeLocale) data ClockTime = ... -- Implementation-dependent instance Ord ClockTime where ... instance Eq ClockTime where ... data Month = January | February | March | April | May | June | July | August | September | October | November | December deriving (Eq, Ord, Enum, Bounded, Ix, Read, Show) data Day = Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday deriving (Eq, Ord, Enum, Bounded, Ix, Read, Show) data CalendarTime = CalendarTime { ctYear :: Int, ctMonth :: Month, ctDay, ctHour, ctMin, ctSec :: Int, ctPicosec :: Integer, ctWDay :: Day, ctYDay :: Int, ctTZName :: String, ctTZ :: Int, ctIsDST :: Bool } deriving (Eq, Ord, Read, Show) data TimeDiff = TimeDiff { tdYear, tdMonth, tdDay, tdHour, tdMin, tdSec :: Int, tdPicosec :: Integer } deriving (Eq, Ord, Read, Show) |
-- Functions on times 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 |
The Time library provides standard functionality for clock times, including timezone information. It follows RFC 1129 in its use of Coordinated Universal Time (UTC).
ClockTime is an abstract type, used for the system's internal clock time. Clock times may be compared directly or converted to a calendar time CalendarTime for I/O or other manipulations. CalendarTime is a user-readable and manipulable representation of the internal ClockTime type. The numeric fields have the following ranges.
|
Function getClockTime returns the current time in its internal representation. The expression 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. The expression diffClockTimes t1 t2 returns the difference between two clock times t1 and t2 as a TimeDiff.
Function toCalendarTime t converts t to a local time, modified by the timezone and daylight savings time settings in force at the time of conversion. toUTCTime t converts t into a CalendarTime in standard UTC format. toClockTime l converts l into the corresponding internal ClockTime ignoring the contents of the ctWDay, ctYDay, ctTZName, and ctIsDST fields. calendarTimeToString formats calendar times using local conventions and a formatting string.
The Haskell 1.4 Library Report
top | back | next | contents