NominalDiffTime -package:numhask-space -package:thyme

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.
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.
This is a length of time, as measured by UTC. Conversion functions will treat it as seconds. It has a precision of 10^-12 s. 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.
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.
No suffix implies the "seconds" unit:
>>> parseOnly nominalDiffTime "10"
Right 10s
Various units (seconds, minutes, hours, days):
>>> parseOnly nominalDiffTime "10s"
Right 10s
>>> parseOnly nominalDiffTime "10m"
Right 600s
>>> parseOnly nominalDiffTime "10h"
Right 36000s
>>> parseOnly nominalDiffTime "10d"
Right 864000s
Metric prefixes to seconds (down to Pico):
>>> parseOnly nominalDiffTime "10ms"
Right 0.01s
>>> parseOnly nominalDiffTime "10μs"
Right 0.00001s
>>> parseOnly nominalDiffTime "10us"
Right 0.00001s
>>> parseOnly nominalDiffTime "10ns"
Right 0.00000001s
>>> parseOnly nominalDiffTime "10ps"
Right 0.00000000001s
Negative values:
>>> parseOnly nominalDiffTime "-1s"
Right -1s
Unsupported units:
>>> parseOnly nominalDiffTime "1k"
Left "nominalDiffTime: Failed reading: Unsupported unit: \"k\""
No suffix implies the "seconds" unit:
>>> parseOnly nominalDiffTime "10"
Right 10s
Various units (seconds, minutes, hours, days):
>>> parseOnly nominalDiffTime "10s"
Right 10s
>>> parseOnly nominalDiffTime "10m"
Right 600s
>>> parseOnly nominalDiffTime "10h"
Right 36000s
>>> parseOnly nominalDiffTime "10d"
Right 864000s
Metric prefixes to seconds (down to Pico):
>>> parseOnly nominalDiffTime "10ms"
Right 0.01s
Notice that "μs" is not supported, because it's not ASCII.
>>> parseOnly nominalDiffTime "10us"
Right 0.00001s
>>> parseOnly nominalDiffTime "10ns"
Right 0.00000001s
>>> parseOnly nominalDiffTime "10ps"
Right 0.00000000001s
Negative values:
>>> parseOnly nominalDiffTime "-1s"
Right -1s
Unsupported units:
>>> parseOnly nominalDiffTime "1k"
Left "nominalDiffTime: Failed reading: Unsupported unit: \"k\""
Get the seconds in a NominalDiffTime.
Create a NominalDiffTime from a number of seconds.