Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Data.Time.Clock
Description
Types and functions for UTC and UT1
Synopsis
- newtype UniversalTime = ModJulianDate {}
- diffTimeToPicoseconds :: DiffTime -> Integer
- picosecondsToDiffTime :: Integer -> DiffTime
- secondsToDiffTime :: Integer -> DiffTime
- data DiffTime
- data UTCTime = UTCTime {
- utctDay :: Day
- utctDayTime :: DiffTime
- nominalDay :: NominalDiffTime
- nominalDiffTimeToSeconds :: NominalDiffTime -> Pico
- secondsToNominalDiffTime :: Pico -> NominalDiffTime
- data NominalDiffTime
- addUTCTime :: NominalDiffTime -> UTCTime -> UTCTime
- diffUTCTime :: UTCTime -> UTCTime -> NominalDiffTime
- getCurrentTime :: IO UTCTime
- getTime_resolution :: DiffTime
Documentation
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
picosecondsToDiffTime :: Integer -> DiffTime Source #
Create a DiffTime
from a number of picoseconds.
secondsToDiffTime :: Integer -> DiffTime Source #
Create a DiffTime
which represents an integral number of seconds.
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.
Instances
NFData DiffTime Source # | |
Defined in Data.Time.Clock.Internal.DiffTime | |
Data DiffTime Source # | |
Defined in Data.Time.Clock.Internal.DiffTime Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> DiffTime -> c DiffTime # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c DiffTime # toConstr :: DiffTime -> Constr # dataTypeOf :: DiffTime -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c DiffTime) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DiffTime) # gmapT :: (forall b. Data b => b -> b) -> DiffTime -> DiffTime # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> DiffTime -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> DiffTime -> r # gmapQ :: (forall d. Data d => d -> u) -> DiffTime -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> DiffTime -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> DiffTime -> m DiffTime # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> DiffTime -> m DiffTime # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> DiffTime -> m DiffTime # | |
Enum DiffTime Source # | |
Defined in Data.Time.Clock.Internal.DiffTime | |
Num DiffTime Source # | |
Defined in Data.Time.Clock.Internal.DiffTime | |
Read DiffTime Source # | |
Fractional DiffTime Source # | |
Real DiffTime Source # | |
Defined in Data.Time.Clock.Internal.DiffTime Methods toRational :: DiffTime -> Rational # | |
RealFrac DiffTime Source # | |
Show DiffTime Source # | |
Eq DiffTime Source # | |
Ord DiffTime Source # | |
Defined in Data.Time.Clock.Internal.DiffTime | |
FormatTime DiffTime Source # | |
Defined in Data.Time.Format.Format.Instances Methods formatCharacter :: Bool -> Char -> Maybe (FormatOptions -> DiffTime -> String) Source # | |
ParseTime DiffTime Source # | |
Defined in Data.Time.Format.Parse.Instances Methods substituteTimeSpecifier :: Proxy DiffTime -> TimeLocale -> Char -> Maybe String Source # parseTimeSpecifier :: Proxy DiffTime -> TimeLocale -> Maybe ParseNumericPadding -> Char -> ReadP String Source # buildTime :: TimeLocale -> [(Char, String)] -> Maybe DiffTime Source # | |
Lift DiffTime 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 | |
Fields
|
Instances
NFData UTCTime Source # | |||||
Defined in Data.Time.Clock.Internal.UTCTime | |||||
Data UTCTime Source # | |||||
Defined in Data.Time.Clock.Internal.UTCTime Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UTCTime -> c UTCTime # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UTCTime # toConstr :: UTCTime -> Constr # dataTypeOf :: UTCTime -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c UTCTime) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UTCTime) # gmapT :: (forall b. Data b => b -> b) -> UTCTime -> UTCTime # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UTCTime -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UTCTime -> r # gmapQ :: (forall d. Data d => d -> u) -> UTCTime -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> UTCTime -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime # | |||||
Generic UTCTime Source # | |||||
Defined in Data.Time.Clock.Internal.UTCTime Associated Types
| |||||
Read UTCTime Source # | |||||
Show UTCTime Source # | |||||
Eq UTCTime Source # | |||||
Ord UTCTime Source # | |||||
Defined in Data.Time.Clock.Internal.UTCTime | |||||
FormatTime UTCTime Source # | |||||
Defined in Data.Time.Format.Format.Instances Methods formatCharacter :: Bool -> Char -> Maybe (FormatOptions -> UTCTime -> String) Source # | |||||
ISO8601 UTCTime Source # |
| ||||
Defined in Data.Time.Format.ISO8601 Methods | |||||
ParseTime UTCTime Source # | |||||
Defined in Data.Time.Format.Parse.Instances Methods substituteTimeSpecifier :: Proxy UTCTime -> TimeLocale -> Char -> Maybe String Source # parseTimeSpecifier :: Proxy UTCTime -> TimeLocale -> Maybe ParseNumericPadding -> Char -> ReadP String Source # buildTime :: TimeLocale -> [(Char, String)] -> Maybe UTCTime Source # | |||||
Lift UTCTime Source # | |||||
type Rep UTCTime Source # | |||||
Defined in Data.Time.Clock.Internal.UTCTime type Rep UTCTime = D1 ('MetaData "UTCTime" "Data.Time.Clock.Internal.UTCTime" "time-1.14-inplace" 'False) (C1 ('MetaCons "UTCTime" 'PrefixI 'True) (S1 ('MetaSel ('Just "utctDay") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Day) :*: S1 ('MetaSel ('Just "utctDayTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 DiffTime))) |
nominalDay :: NominalDiffTime Source #
One day in NominalDiffTime
.
nominalDiffTimeToSeconds :: NominalDiffTime -> Pico Source #
Get the seconds in a NominalDiffTime
.
Since: time-1.9.1
secondsToNominalDiffTime :: Pico -> NominalDiffTime Source #
Create a NominalDiffTime
from a number of seconds.
Since: time-1.9.1
data NominalDiffTime Source #
This is a length of time, as measured by UTC. It has a precision of 10^-12 s.
Conversion functions such as fromInteger
and realToFrac
will treat it as seconds.
For example, (0.010 :: NominalDiffTime)
corresponds to 10 milliseconds.
It has a precision of one picosecond (= 10^-12 s). 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.
Instances
NFData NominalDiffTime Source # | |
Defined in Data.Time.Clock.Internal.NominalDiffTime Methods rnf :: NominalDiffTime -> () Source # | |
Data NominalDiffTime Source # | |
Defined in Data.Time.Clock.Internal.NominalDiffTime Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> NominalDiffTime -> c NominalDiffTime # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c NominalDiffTime # toConstr :: NominalDiffTime -> Constr # dataTypeOf :: NominalDiffTime -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c NominalDiffTime) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NominalDiffTime) # gmapT :: (forall b. Data b => b -> b) -> NominalDiffTime -> NominalDiffTime # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> NominalDiffTime -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> NominalDiffTime -> r # gmapQ :: (forall d. Data d => d -> u) -> NominalDiffTime -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> NominalDiffTime -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> NominalDiffTime -> m NominalDiffTime # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> NominalDiffTime -> m NominalDiffTime # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> NominalDiffTime -> m NominalDiffTime # | |
Enum NominalDiffTime Source # | |
Defined in Data.Time.Clock.Internal.NominalDiffTime Methods succ :: NominalDiffTime -> NominalDiffTime # pred :: NominalDiffTime -> NominalDiffTime # toEnum :: Int -> NominalDiffTime # fromEnum :: NominalDiffTime -> Int # enumFrom :: NominalDiffTime -> [NominalDiffTime] # enumFromThen :: NominalDiffTime -> NominalDiffTime -> [NominalDiffTime] # enumFromTo :: NominalDiffTime -> NominalDiffTime -> [NominalDiffTime] # enumFromThenTo :: NominalDiffTime -> NominalDiffTime -> NominalDiffTime -> [NominalDiffTime] # | |
Num NominalDiffTime Source # | |
Defined in Data.Time.Clock.Internal.NominalDiffTime Methods (+) :: NominalDiffTime -> NominalDiffTime -> NominalDiffTime # (-) :: NominalDiffTime -> NominalDiffTime -> NominalDiffTime # (*) :: NominalDiffTime -> NominalDiffTime -> NominalDiffTime # negate :: NominalDiffTime -> NominalDiffTime # abs :: NominalDiffTime -> NominalDiffTime # signum :: NominalDiffTime -> NominalDiffTime # fromInteger :: Integer -> NominalDiffTime # | |
Read NominalDiffTime Source # | |
Defined in Data.Time.Clock.Internal.NominalDiffTime Methods readsPrec :: Int -> ReadS NominalDiffTime # readList :: ReadS [NominalDiffTime] # | |
Fractional NominalDiffTime Source # | |
Defined in Data.Time.Clock.Internal.NominalDiffTime Methods (/) :: NominalDiffTime -> NominalDiffTime -> NominalDiffTime # recip :: NominalDiffTime -> NominalDiffTime # fromRational :: Rational -> NominalDiffTime # | |
Real NominalDiffTime Source # | |
Defined in Data.Time.Clock.Internal.NominalDiffTime Methods toRational :: NominalDiffTime -> Rational # | |
RealFrac NominalDiffTime Source # | |
Defined in Data.Time.Clock.Internal.NominalDiffTime Methods properFraction :: Integral b => NominalDiffTime -> (b, NominalDiffTime) # truncate :: Integral b => NominalDiffTime -> b # round :: Integral b => NominalDiffTime -> b # ceiling :: Integral b => NominalDiffTime -> b # floor :: Integral b => NominalDiffTime -> b # | |
Show NominalDiffTime Source # | |
Defined in Data.Time.Clock.Internal.NominalDiffTime Methods showsPrec :: Int -> NominalDiffTime -> ShowS # show :: NominalDiffTime -> String # showList :: [NominalDiffTime] -> ShowS # | |
Eq NominalDiffTime Source # | |
Defined in Data.Time.Clock.Internal.NominalDiffTime Methods (==) :: NominalDiffTime -> NominalDiffTime -> Bool # (/=) :: NominalDiffTime -> NominalDiffTime -> Bool # | |
Ord NominalDiffTime Source # | |
Defined in Data.Time.Clock.Internal.NominalDiffTime Methods compare :: NominalDiffTime -> NominalDiffTime -> Ordering # (<) :: NominalDiffTime -> NominalDiffTime -> Bool # (<=) :: NominalDiffTime -> NominalDiffTime -> Bool # (>) :: NominalDiffTime -> NominalDiffTime -> Bool # (>=) :: NominalDiffTime -> NominalDiffTime -> Bool # max :: NominalDiffTime -> NominalDiffTime -> NominalDiffTime # min :: NominalDiffTime -> NominalDiffTime -> NominalDiffTime # | |
FormatTime NominalDiffTime Source # | |
Defined in Data.Time.Format.Format.Instances Methods formatCharacter :: Bool -> Char -> Maybe (FormatOptions -> NominalDiffTime -> String) Source # | |
ParseTime NominalDiffTime Source # | |
Defined in Data.Time.Format.Parse.Instances Methods substituteTimeSpecifier :: Proxy NominalDiffTime -> TimeLocale -> Char -> Maybe String Source # parseTimeSpecifier :: Proxy NominalDiffTime -> TimeLocale -> Maybe ParseNumericPadding -> Char -> ReadP String Source # buildTime :: TimeLocale -> [(Char, String)] -> Maybe NominalDiffTime Source # | |
Lift NominalDiffTime Source # | |
Defined in Data.Time.Clock.Internal.NominalDiffTime Methods lift :: Quote m => NominalDiffTime -> m Exp # liftTyped :: forall (m :: Type -> Type). Quote m => NominalDiffTime -> Code m NominalDiffTime # |
addUTCTime :: NominalDiffTime -> UTCTime -> UTCTime Source #
addUTCTime a b = a + b
diffUTCTime :: UTCTime -> UTCTime -> NominalDiffTime Source #
diffUTCTime a b = a - b
getTime_resolution :: DiffTime Source #
The resolution of getSystemTime
, getCurrentTime
, getPOSIXTime
.
On UNIX systems this uses clock_getres
, which may be wrong on WSL2.