> interface LibTime where
ClockTime
is an abstract type, used for the internal
clock time. Clock times may be compared, converted to strings, or
converted to an external calendar time CalendarTime
.
> data ClockTime > instance Ord ClockTime > instance Eq ClockTime
When a ClockTime
is shown, it is converted to a string of the form
"Mon Nov 28 21:45:41 GMT 1994"
.
> instance Text ClockTime where > showsPrec _ t _ = ...
CalendarTime
is a user-readable and manipulable
representation of the internal ClockTime
type. The
numeric fields have the following ranges.
Value Range Comments ----- ----- -------- year -maxInt .. maxInt [Pre-Gregorian dates are inaccurate] mon 0 .. 11 [Jan = 0, Dec = 11] day 1 .. 31 hour 0 .. 23 min 0 .. 59 sec 0 .. 61 [Allows for two Leap Seconds] picosec 0 .. (10^12)-1 [This could be over-precise?] wday 0 .. 6 [Sunday = 0, Saturday = 6] yday 0 .. 365 [364 in non-Leap years] tz -43200 .. 43200 [Variation from UTC in seconds]
The tzname field is the name of the time zone. The isdst field indicates whether Daylight Savings Time would be in effect.
> -- year mon day hour min sec picosec wday yday tzname tz isdst > data CalendarTime = > CalendarTime Int Int Int Int Int Int Integer Int Int String Int Bool
The TimeDiff
type records the difference between two clock times in
a user-readable way.
> -- year mon day hour min sec picosec > data TimeDiff = TimeDiff Int Int Int Int Int Int Integer > deriving (Eq,Ord)
getClockTime
returns the current time in its internal representation.
> getClockTime :: IO ClockTime
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. diffClockTimes
t1 t2 returns
the difference between two clock times t1 and t2 as a TimeDiff
.
> addToClockTime :: TimeDiff -> ClockTime -> ClockTime > diffClockTimes :: ClockTime -> ClockTime -> TimeDiff
toCalendarTime
t converts t to a
local time, modified by the current timezone and daylight savings time
settings. toUTCTime
t converts t into UTC
time. toClockTime
l converts
l into the corresponding internal ClockTime
.
The wday, yday, tzname, and isdst
fields are ignored.
> toCalendarTime :: ClockTime -> CalendarTime > toUTCTime :: ClockTime -> CalendarTime > toClockTime :: CalendarTime -> ClockTime