Module Time

Library for handling date and time information.

Author: Michael Hanus

Version: January 2018

Summary of exported operations:

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

The year of a calendar time.

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

ctMonth :: CalendarTime -> Int   

The month of a calendar time.

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

ctDay :: CalendarTime -> Int   

The day of a calendar time.

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

ctHour :: CalendarTime -> Int   

The hour of a calendar time.

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

ctMin :: CalendarTime -> Int   

The minute of a calendar time.

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

ctSec :: CalendarTime -> Int   

The second of a calendar time.

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

ctTZ :: CalendarTime -> Int   

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   

Returns the current clock time.

Further infos:
  • externally defined

getLocalTime :: IO CalendarTime   

Returns the local calendar time.

clockTimeToInt :: ClockTime -> Int   

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   

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   

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

toClockTime :: CalendarTime -> ClockTime   

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

calendarTimeToString :: CalendarTime -> String   

Transforms a calendar time into a readable form.

toDayString :: CalendarTime -> String   

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

toTimeString :: CalendarTime -> String   

Transforms a calendar time into a string containing the time.

addSeconds :: Int -> ClockTime -> ClockTime   

Adds seconds to a given time.

addMinutes :: Int -> ClockTime -> ClockTime   

Adds minutes to a given time.

addHours :: Int -> ClockTime -> ClockTime   

Adds hours to a given time.

addDays :: Int -> ClockTime -> ClockTime   

Adds days to a given time.

addMonths :: Int -> ClockTime -> ClockTime   

Adds months to a given time.

addYears :: Int -> ClockTime -> ClockTime   

Adds years to a given time.

daysOfMonth :: Int -> Int -> Int   

Gets the days of a month in a year.

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

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

compareDate :: CalendarTime -> CalendarTime -> Ordering   

Compares two dates (don't use it, just for backward compatibility!).

compareCalendarTime :: CalendarTime -> CalendarTime -> Ordering   

Compares two calendar times.

compareClockTime :: ClockTime -> ClockTime -> Ordering   

Compares two clock times.