module Data.Time.Hora.Future where
import Data.Time.Clock
import Data.Time.Hora.Type.Time
import Data.Time.Hora.Convert
import Prelude as P
import Data.Fixed
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