What is the rationale behind providing DiffTime
and NominalDiffTime
in Data.Time.Clock?
Currently, I don't see the need for both.
Also, I don't understand why for NominalDiffTime
there is diffUTCTime
, while for DiffTime
there is not such a function.
I mean, it looks like DiffTime
and NominalDiffTime
are not really 'symmetric' to each other.
Perhaps to sum it up: What is the difference between those algebraic datatypes?
NominalDiffTime
ignores leap-seconds and you can be sure that diffUTCTime
between 23:00 UTC and 01:00 UTC of next day is always 2 hours, without any seconds added.
Result of DiffTime
can be changed by other factors, for example, leap-seconds. This is measured as with stopwatch: if, for some reasons, between 23:00 UTC and 01:00 UTC is not 2 hours, this type will show it.
In practice, they did not differ.
EDIT: They have different objectives.
NominalDiffTime
is for calculating difference between the times.DiffTime
is for measured time (with stopwatch, for example).If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With