Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Types and functions for UTC and UT1
Synopsis
- newtype UniversalTime = ModJulianDate {}
- data DiffTime
- secondsToDiffTime :: Integer -> DiffTime
- picosecondsToDiffTime :: Integer -> DiffTime
- diffTimeToPicoseconds :: DiffTime -> Integer
- data UTCTime = UTCTime {
- utctDay :: Day
- utctDayTime :: DiffTime
- data NominalDiffTime
- secondsToNominalDiffTime :: Pico -> NominalDiffTime
- nominalDiffTimeToSeconds :: NominalDiffTime -> Pico
- nominalDay :: 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.
Instances
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
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.
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.
UTCTime | |
|
Instances
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
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
getTime_resolution :: DiffTime Source #
The resolution of getSystemTime
, getCurrentTime
, getPOSIXTime
.
On UNIX systems this uses clock_getres
, which may be wrong on WSL2.