Module Data.Time

Library for handling date and time information.

Author: Michael Hanus

Version: January 2018

Summary of exported operations:

ctYear :: CalendarTime -> Int  Deterministic 
The year of a calendar time.
ctMonth :: CalendarTime -> Int  Deterministic 
The month of a calendar time.
ctDay :: CalendarTime -> Int  Deterministic 
The day of a calendar time.
ctHour :: CalendarTime -> Int  Deterministic 
The hour of a calendar time.
ctMin :: CalendarTime -> Int  Deterministic 
The minute of a calendar time.
ctSec :: CalendarTime -> Int  Deterministic 
The second of a calendar time.
ctTZ :: CalendarTime -> Int  Deterministic 
The time zone of a calendar time.
getClockTime :: IO ClockTime  Deterministic 
Returns the current clock time.
getLocalTime :: IO CalendarTime  Deterministic 
Returns the local calendar time.
clockTimeToInt :: ClockTime -> Int  Deterministic 
Transforms a clock time into a unique integer.
toCalendarTime :: ClockTime -> IO CalendarTime  Deterministic 
Transforms a clock time into a calendar time according to the local time (if possible).
toUTCTime :: ClockTime -> CalendarTime  Deterministic 
Transforms a clock time into a standard UTC calendar time.
toClockTime :: CalendarTime -> ClockTime  Deterministic 
Transforms a calendar time (interpreted as UTC time) into a clock time.
calendarTimeToString :: CalendarTime -> String  Deterministic 
Transforms a calendar time into a readable form.
toDayString :: CalendarTime -> String  Deterministic 
Transforms a calendar time into a string containing the day, e.g., "September 23, 2006".
toTimeString :: CalendarTime -> String  Deterministic 
Transforms a calendar time into a string containing the time.
addSeconds :: Int -> ClockTime -> ClockTime  Deterministic 
Adds seconds to a given time.
addMinutes :: Int -> ClockTime -> ClockTime  Deterministic 
Adds minutes to a given time.
addHours :: Int -> ClockTime -> ClockTime  Deterministic 
Adds hours to a given time.
addDays :: Int -> ClockTime -> ClockTime  Deterministic 
Adds days to a given time.
addMonths :: Int -> ClockTime -> ClockTime  Deterministic 
Adds months to a given time.
addYears :: Int -> ClockTime -> ClockTime  Deterministic 
Adds years to a given time.
daysOfMonth :: Int -> Int -> Int  Deterministic 
Gets the days of a month in a year.
validDate :: Int -> Int -> Int -> Bool  Deterministic 
Is a date consisting of year/month/day valid?
compareCalendarTime :: CalendarTime -> CalendarTime -> Ordering  Deterministic 
Compares two calendar times.
compareClockTime :: ClockTime -> ClockTime -> Ordering  Deterministic 
Compares two clock times.

Exported datatypes:


ClockTime

ClockTime represents a clock time in some internal representation.

Constructors:


CalendarTime

A calendar time is presented in the following form: (CalendarTime year month day hour minute second timezone) where timezone is an integer representing the timezone as a difference to UTC time in seconds.

Constructors:

  • CalendarTime :: Int -> Int -> Int -> Int -> Int -> Int -> Int -> CalendarTime

Exported operations:

ctYear :: CalendarTime -> Int  Deterministic 

The year of a calendar time.

Further infos:
  • solution complete, i.e., able to compute all solutions

ctMonth :: CalendarTime -> Int  Deterministic 

The month of a calendar time.

Further infos:
  • solution complete, i.e., able to compute all solutions

ctDay :: CalendarTime -> Int  Deterministic 

The day of a calendar time.

Further infos:
  • solution complete, i.e., able to compute all solutions

ctHour :: CalendarTime -> Int  Deterministic 

The hour of a calendar time.

Further infos:
  • solution complete, i.e., able to compute all solutions

ctMin :: CalendarTime -> Int  Deterministic 

The minute of a calendar time.

Further infos:
  • solution complete, i.e., able to compute all solutions

ctSec :: CalendarTime -> Int  Deterministic 

The second of a calendar time.

Further infos:
  • solution complete, i.e., able to compute all solutions

ctTZ :: CalendarTime -> Int  Deterministic 

The time zone of a calendar time. The value of the time zone is the difference to UTC time in seconds.

Further infos:
  • solution complete, i.e., able to compute all solutions

getClockTime :: IO ClockTime  Deterministic 

Returns the current clock time.

Further infos:
  • externally defined

getLocalTime :: IO CalendarTime  Deterministic 

Returns the local calendar time.

clockTimeToInt :: ClockTime -> Int  Deterministic 

Transforms a clock time into a unique integer. It is ensured that clock times that differs in at least one second are mapped into different integers.

Further infos:
  • solution complete, i.e., able to compute all solutions

toCalendarTime :: ClockTime -> IO CalendarTime  Deterministic 

Transforms a clock time into a calendar time according to the local time (if possible). Since the result depends on the local environment, it is an I/O operation.

toUTCTime :: ClockTime -> CalendarTime  Deterministic 

Transforms a clock time into a standard UTC calendar time. Thus, this operation is independent on the local time.

toClockTime :: CalendarTime -> ClockTime  Deterministic 

Transforms a calendar time (interpreted as UTC time) into a clock time.

calendarTimeToString :: CalendarTime -> String  Deterministic 

Transforms a calendar time into a readable form.

toDayString :: CalendarTime -> String  Deterministic 

Transforms a calendar time into a string containing the day, e.g., "September 23, 2006".

toTimeString :: CalendarTime -> String  Deterministic 

Transforms a calendar time into a string containing the time.

addSeconds :: Int -> ClockTime -> ClockTime  Deterministic 

Adds seconds to a given time.

addMinutes :: Int -> ClockTime -> ClockTime  Deterministic 

Adds minutes to a given time.

addHours :: Int -> ClockTime -> ClockTime  Deterministic 

Adds hours to a given time.

addDays :: Int -> ClockTime -> ClockTime  Deterministic 

Adds days to a given time.

addMonths :: Int -> ClockTime -> ClockTime  Deterministic 

Adds months to a given time.

addYears :: Int -> ClockTime -> ClockTime  Deterministic 

Adds years to a given time.

daysOfMonth :: Int -> Int -> Int  Deterministic 

Gets the days of a month in a year.

validDate :: Int -> Int -> Int -> Bool  Deterministic 

Is a date consisting of year/month/day valid?

compareCalendarTime :: CalendarTime -> CalendarTime -> Ordering  Deterministic 

Compares two calendar times.

compareClockTime :: ClockTime -> ClockTime -> Ordering  Deterministic 

Compares two clock times.