| |||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||
| Synopsis | |||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||
| ClockTime | |||||||||||||||||||||||||||||||||||||||||||
| data ClockTime | |||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||
| getClockTime :: IO ClockTime | |||||||||||||||||||||||||||||||||||||||||||
| Returns the current absolute time. | |||||||||||||||||||||||||||||||||||||||||||
Our ClockTime is defined in terms of TAI, because this provides an absolute time scale and can be used for accurate time calculations. However, this is not always implementable. Many systems run their system clocks on a time scale that ignores leap seconds. For example, POSIX's time_t uses a broken notion of "seconds since the epoch", defined by a formula in terms of UTC time ignoring leap seconds. On systems which run their clocks on time_t time, the library will do its best to convert to TAI time for a ClockTime. The effect is that the ClockTime might be incorrect by up to 1 second around the time of a leap second (it depends on how your system adjusts its clock when a leap second occurs). Regardless of what the system supports, calculations on values of type ClockTime are well-defined and deterministic. Inaccuracies only occur at the boundaries:
| |||||||||||||||||||||||||||||||||||||||||||
| Timezones | |||||||||||||||||||||||||||||||||||||||||||
| data Timezone | |||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||
| utcTimezone :: Timezone | |||||||||||||||||||||||||||||||||||||||||||
| The UTC timezone | |||||||||||||||||||||||||||||||||||||||||||
| taiTimezone :: Timezone | |||||||||||||||||||||||||||||||||||||||||||
| The TAI timezone | |||||||||||||||||||||||||||||||||||||||||||
| timezoneFromUTCOffset :: Int -> Timezone | |||||||||||||||||||||||||||||||||||||||||||
| Make a Timezone from an offset, in seconds relative to UTC, which must be smaller in magnitude than +/-12*60*60. | |||||||||||||||||||||||||||||||||||||||||||
| timezoneFromName :: String -> Maybe Timezone | |||||||||||||||||||||||||||||||||||||||||||
| Make a Timezone from a standard timezone name (eg. GMT, PDT). TAI is a valid timezone name. | |||||||||||||||||||||||||||||||||||||||||||
| timezoneUTCOffset :: Timezone -> Maybe Int | |||||||||||||||||||||||||||||||||||||||||||
| Return the offset in seconds of the specified timezone relative to UTC. If the timezone is TAI, returns Nothing, because TAI cannot be represented as a fixed offset relative to UTC. | |||||||||||||||||||||||||||||||||||||||||||
| timezoneName :: Timezone -> String | |||||||||||||||||||||||||||||||||||||||||||
Return the timezone name corresponding to a Timezone value. Some timezones may not correspond to a name, or the name of the timezone may not be known (some systems cannot convert easily from UTC offsets to timezone names), in which case timezoneName returns Nothing. Some timezone names correspond to more than one actual timezone. These are: CST, CDT, EST, and EDT. Each of these is used for an Australian timezone in addition to a North American one. timezoneName is defined to return the North American versions of these. If you want the Australian versions, you can use the non-ambiguous names ACST, ACDT, AEST and AEDT respectively. | |||||||||||||||||||||||||||||||||||||||||||
| getCurrentTimezone :: IO Timezone | |||||||||||||||||||||||||||||||||||||||||||
| Returns the current timezone from the environment. On Unix, the current timezone is taken from the TZ environment variable, or the system default if TZ is not set. | |||||||||||||||||||||||||||||||||||||||||||
| CalendarTime | |||||||||||||||||||||||||||||||||||||||||||
| data CalendarTime | |||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||
| clockTimeToCalendarTime :: ClockTime -> IO CalendarTime | |||||||||||||||||||||||||||||||||||||||||||
| Converts a ClockTime to a CalendarTime in the current timezone. Caveats for clockTimeToUTCTime also apply here. | |||||||||||||||||||||||||||||||||||||||||||
| clockTimeToUTCTime :: ClockTime -> CalendarTime | |||||||||||||||||||||||||||||||||||||||||||
Converts a ClockTime to a CalendarTime in UTC. Note that this function may produce unpredictable results for times sufficiently far in the future, because it is not known when leap seconds will need to be added to or subtracted from UTC. | |||||||||||||||||||||||||||||||||||||||||||
| clockTimeToTAITime :: ClockTime -> CalendarTime | |||||||||||||||||||||||||||||||||||||||||||
| Converts a ClockTime to a CalendarTime in TAI. Always produces predictable results. | |||||||||||||||||||||||||||||||||||||||||||
| clockTimeToCalendarTimeTZ :: Timezone -> ClockTime -> CalendarTime | |||||||||||||||||||||||||||||||||||||||||||
| Converts a ClockTime to a CalendarTime in the specified timezone. Caveats for clockTimeToUTCTime also apply here. | |||||||||||||||||||||||||||||||||||||||||||
| calendarTimeToClockTime :: CalendarTime -> Maybe ClockTime | |||||||||||||||||||||||||||||||||||||||||||
| Convert a CalendarTime to a ClockTime. Some values of CalendarTime do not represent a valid ClockTime, hence this function returns a Maybe type. | |||||||||||||||||||||||||||||||||||||||||||
| calendarTimeDayOffsets :: CalendarTime -> (Int, Int) | |||||||||||||||||||||||||||||||||||||||||||
| Return the day of the week and the day of the year for a given CalendarTime. | |||||||||||||||||||||||||||||||||||||||||||
| formatCalendarTime :: TimeLocale -> String -> CalendarTime -> String | |||||||||||||||||||||||||||||||||||||||||||
| Produced by Haddock version 0.6 | |||||||||||||||||||||||||||||||||||||||||||