time-1.1.4: A time librarySource codeContentsIndex
Data.Time.Clock
Contents
Universal Time
Absolute intervals
UTC
Description
Types and functions for UTC and UT1
Synopsis
newtype UniversalTime = ModJulianDate {
getModJulianDate :: Rational
}
data DiffTime
secondsToDiffTime :: Integer -> DiffTime
picosecondsToDiffTime :: Integer -> DiffTime
data UTCTime = UTCTime {
utctDay :: Day
utctDayTime :: DiffTime
}
data NominalDiffTime
addUTCTime :: NominalDiffTime -> UTCTime -> UTCTime
diffUTCTime :: UTCTime -> UTCTime -> NominalDiffTime
getCurrentTime :: IO UTCTime
Universal Time
Time as measured by the earth.
newtype UniversalTime Source
The Modified Julian Date is the day with the fraction of the day, measured from UT midnight. It's used to represent UT1, which is time as measured by the earth's rotation, adjusted for various wobbles.
Constructors
ModJulianDate
getModJulianDate :: Rational
show/hide Instances
Absolute intervals
data DiffTime Source
This is a length of time, as measured by a clock. Conversion functions will treat it as seconds. It has a precision of 10^-12 s.
show/hide Instances
secondsToDiffTime :: Integer -> DiffTimeSource
Create a DiffTime which represents an integral number of seconds.
picosecondsToDiffTime :: Integer -> DiffTimeSource
Create a DiffTime from a number of picoseconds.
UTC

UTC is time as measured by a clock, corrected to keep pace with the earth by adding or removing occasional seconds, known as "leap seconds". These corrections are not predictable and are announced with six month's notice. No table of these corrections is provided, as any program compiled with it would become out of date in six months.

If you don't care about leap seconds, use UTCTime and NominalDiffTime for your clock calculations, and you'll be fine.

data UTCTime Source
This is the simplest representation of UTC. It consists of the day number, and a time offset from midnight. Note that if a day has a leap second added to it, it will have 86401 seconds.
Constructors
UTCTime
utctDay :: Daythe day
utctDayTime :: DiffTimethe time from midnight, 0 <= t < 86401s (because of leap-seconds)
show/hide Instances
data NominalDiffTime Source
This is a length of time, as measured by UTC. Conversion functions will treat it as seconds. It has a precision of 10^-12 s. It ignores leap-seconds, so it's not necessarily a fixed amount of clock time. For instance, 23:00 UTC + 2 hours of NominalDiffTime = 01:00 UTC (+ 1 day), regardless of whether a leap-second intervened.
show/hide Instances
addUTCTime :: NominalDiffTime -> UTCTime -> UTCTimeSource
addUTCTime a b = a + b
diffUTCTime :: UTCTime -> UTCTime -> NominalDiffTimeSource
diffUTCTime a b = a - b
getCurrentTime :: IO UTCTimeSource
Get the current UTC time from the system clock.
Produced by Haddock version 2.4.2