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.
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.
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.
An interval or duration of time, as would be measured by a stopwatch. DiffTime is an instance of AdditiveGroup as well as VectorSpace, with Rational as its Scalar. We do not provide Num, Real, Fractional nor RealFrac instances here. See Data.Thyme.Docs#spaces for details.
> fromSeconds' 100 :: DiffTime
100s
> fromSeconds' 100 ^+^ fromSeconds' 100 ^* 4
500s
> fromSeconds' 100 ^-^ fromSeconds' 100 ^/ 4
75s
No suffix implies the "seconds" unit:
>>> parseOnly diffTime "10"
Right 10s
Various units (seconds, minutes, hours, days):
>>> parseOnly diffTime "10s"
Right 10s
>>> parseOnly diffTime "10m"
Right 600s
>>> parseOnly diffTime "10h"
Right 36000s
>>> parseOnly diffTime "10d"
Right 864000s
Metric prefixes to seconds (down to Pico):
>>> parseOnly diffTime "10ms"
Right 0.01s
>>> parseOnly diffTime "10μs"
Right 0.00001s
>>> parseOnly diffTime "10us"
Right 0.00001s
>>> parseOnly diffTime "10ns"
Right 0.00000001s
>>> parseOnly diffTime "10ps"
Right 0.00000000001s
Negative values:
>>> parseOnly diffTime "-1s"
Right -1s
Unsupported units:
>>> parseOnly diffTime "1k"
Left "diffTime: Failed reading: Unsupported unit: \"k\""
Compute the difference between two timestamps. Mnemonic: diffTime behaves like the (-) operator: diffTime earlier later = later `diffTime' earlier is the duration it takes from earlier to later.
No suffix implies the "seconds" unit:
>>> parseOnly diffTime "10"
Right 10s
Various units (seconds, minutes, hours, days):
>>> parseOnly diffTime "10s"
Right 10s
>>> parseOnly diffTime "10m"
Right 600s
>>> parseOnly diffTime "10h"
Right 36000s
>>> parseOnly diffTime "10d"
Right 864000s
Metric prefixes to seconds (down to Pico):
>>> parseOnly diffTime "10ms"
Right 0.01s
Notice that "μs" is not supported, because it's not ASCII.
>>> parseOnly diffTime "10us"
Right 0.00001s
>>> parseOnly diffTime "10ns"
Right 0.00000001s
>>> parseOnly diffTime "10ps"
Right 0.00000000001s
Negative values:
>>> parseOnly diffTime "-1s"
Right -1s
Unsupported units:
>>> parseOnly diffTime "1k"
Left "diffTime: Failed reading: Unsupported unit: \"k\""
Get the number of picoseconds in a DiffTime.
Compute the absolute difference.
Compute the absolute difference.
Convert of differential of time of a day. (it convers a Data.Time.Clock.DiffTime into a TimeOfDay) Example with DiffTime type from time:
import qualified Data.Time.Clock as T

difftime :: T.DiffTime

diffTimeToTimeOfDay difftime
Example with the TimeOfDay type from time:
import qualified Data.Time.Clock as T

timeofday :: T.TimeOfDay

diffTimeToTimeOfDay $ T.timeOfDayToTime timeofday
given a NominalDiffTim, provide an equivalent Delay@
given a NominalDiffTim, provide an equivalent TimeInterval@
Take the difference of two time specs, as a DiffTime.
DiffTime in a compact decimal format based on picoseconds.
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.
Get the seconds in a NominalDiffTime.
Create a DiffTime from a number of picoseconds.