Data.Time.Clock
Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Contents
Description
Types and functions for UTC and UT1
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 | |
Fields |
Instances
Absolute intervals
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.
Instances
secondsToDiffTime :: Integer -> DiffTime Source
Create a DiffTime
which represents an integral number of seconds.
picosecondsToDiffTime :: Integer -> DiffTime Source
Create a DiffTime
from a number of picoseconds.
diffTimeToPicoseconds :: DiffTime -> Integer Source
Get the number of picoseconds in a DiffTime
.
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.
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 | |
Fields
|
Instances
Eq UTCTime | |
Data UTCTime | |
Defined in Data.Time.Clock.Internal.UTCTime Methodsgfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UTCTime -> c UTCTime Source gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UTCTime Source toConstr :: UTCTime -> Constr Source dataTypeOf :: UTCTime -> DataType Source dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c UTCTime) Source dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UTCTime) Source gmapT :: (forall b. Data b => b -> b) -> UTCTime -> UTCTime Source gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UTCTime -> r Source gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UTCTime -> r Source gmapQ :: (forall d. Data d => d -> u) -> UTCTime -> [u] Source gmapQi :: Int -> (forall d. Data d => d -> u) -> UTCTime -> u Source gmapM :: Monad m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime Source gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime Source gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime Source | |
Ord UTCTime | |
Defined in Data.Time.Clock.Internal.UTCTime | |
Read UTCTime | |
Show UTCTime | |
NFData UTCTime | |
Defined in Data.Time.Clock.Internal.UTCTime | |
ParseTime UTCTime | |
Defined in Data.Time.Format.Parse.Instances MethodssubstituteTimeSpecifier :: proxy UTCTime -> TimeLocale -> Char -> Maybe String Source parseTimeSpecifier :: proxy UTCTime -> TimeLocale -> Maybe ParseNumericPadding -> Char -> ReadP String Source buildTime :: TimeLocale -> [(Char, String)] -> Maybe UTCTime Source | |
FormatTime UTCTime | |
Defined in Data.Time.Format.Format.Instances | |
ISO8601 UTCTime |
|
Defined in Data.Time.Format.ISO8601 Methods |
data NominalDiffTime Source
This is a length of time, as measured by UTC. It has a precision of 10^-12 s.
Conversion functions will treat it as seconds. For example, (0.010 :: NominalDiffTime)
corresponds to 10 milliseconds.
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.
Instances
secondsToNominalDiffTime :: Pico -> NominalDiffTime Source
Create a NominalDiffTime
from a number of seconds.
Since: time-1.9.1
nominalDiffTimeToSeconds :: NominalDiffTime -> Pico Source
Get the seconds in a NominalDiffTime
.
Since: time-1.9.1
nominalDay :: NominalDiffTime Source
One day in NominalDiffTime
.
addUTCTime :: NominalDiffTime -> UTCTime -> UTCTime Source
addUTCTime a b = a + b
diffUTCTime :: UTCTime -> UTCTime -> NominalDiffTime Source
diffUTCTime a b = a - b
getCurrentTime :: IO UTCTime Source
Get the current UTCTime
from the system clock.
getTime_resolution :: DiffTime Source
The resolution of getSystemTime
, getCurrentTime
, getPOSIXTime
© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/8.10.2/docs/html/libraries/time-1.9.3/Data-Time-Clock.html