HORIZON HASKELLDocslts/ghc-9.14.x45dd5372026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Moduletime-1.15GHC2021

Data.Time.Clock

Types and functions for UTC and UT1

  • 4 types
  • 10 values
  • Packagetime-1.15
  • Exports19
  • LanguageGHC2021
  • LicenceBSD-2-Clause
  • SourceClock.hs

Universal Time

1 declaration

Time as measured by the Earth.

newtypenewtype UniversalTime
#

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.

Instances11Eq, Data, Ord, Read, Show, Generic, …

Absolute intervals

8 declarations
newtypenewtype DiffTime
#

This is a length of time, as measured by a clock. Conversion functions such as fromInteger and realToFrac will treat it as seconds. For example, (0.010 :: DiffTime) corresponds to 10 milliseconds.

It has a precision of one picosecond (= 10^-12 s). Enumeration functions will treat it as picoseconds.

Instances14Enum, Eq, Fractional, Data, Num, Ord, …
  • Enum DiffTimeDefined in time-1.15 · Data.Time.Clock.Internal.DiffTime
  • Eq DiffTimeDefined in time-1.15 · Data.Time.Clock.Internal.DiffTime
  • Fractional DiffTimeDefined in time-1.15 · Data.Time.Clock.Internal.DiffTime
  • Data DiffTimeDefined in time-1.15 · Data.Time.Clock.Internal.DiffTime
  • Num DiffTimeDefined in time-1.15 · Data.Time.Clock.Internal.DiffTime
  • Ord DiffTimeDefined in time-1.15 · Data.Time.Clock.Internal.DiffTime
  • Read DiffTimeDefined in time-1.15 · Data.Time.Clock.Internal.DiffTime
  • Real DiffTimeDefined in time-1.15 · Data.Time.Clock.Internal.DiffTime
  • RealFrac DiffTimeDefined in time-1.15 · Data.Time.Clock.Internal.DiffTime
  • Show DiffTimeDefined in time-1.15 · Data.Time.Clock.Internal.DiffTime
  • NFData DiffTimeDefined in time-1.15 · Data.Time.Clock.Internal.DiffTime
  • FormatTime DiffTimeDefined in time-1.15 · Data.Time.Format.Format.Instances · orphan
  • ParseTime DiffTimeDefined in time-1.15 · Data.Time.Format.Parse.Instances · orphan
  • Lift DiffTimeDefined in time-1.15 · Data.Time.Clock.Internal.DiffTime

UTC

10 declarations

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.

datadata UTCTime
#

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

Instances12Eq, Data, Ord, Read, Show, Generic, …
newtypenewtype NominalDiffTime
#

This is a length of time, as measured by UTC. It has a precision of one picosecond (10^-12 s).

Conversion functions such as fromInteger and realToFrac will treat it as seconds. For example, (0.010 :: NominalDiffTime) corresponds to 10 milliseconds.

Enumeration functions will treat it as picoseconds.

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.

Instances14Enum, Eq, Fractional, Data, Num, Ord, …