module Data.Time.Hora.Future where
import Data.Fixed
import Data.Time.Clock
import Data.Time.Hora.Span
import Data.Time.Hora.Type
import Prelude as P
futureUTCTime::Integral a => TimeSpan a -> IO UTCTime
futureUTCTime ts0 = getCurrentTime >>=
pure . (addUTCTime diff1)
where diff1 = nominalDiff ts0
class PicoDiff a where
(-)::a -> a -> TimeSpan Integer
instance PicoDiff UTCTime where
(-) t2 t1 =
let t1_ = utctDayTime t1
t2_ = utctDayTime t2
d3 = diffTimeToPicoseconds $ t2_ P.- t1_
in Pico d3
instance PicoDiff Pico where
(-) (MkFixed t2) (MkFixed t1) = Pico $ t2 P.- t1