Movatterモバイル変換
[0]ホーム
modulePostgreSQL.Binary.IntervalwhereimportPostgreSQL.Binary.Preludehiding(months)importqualifiedPostgreSQL.Binary.TimeasTimedataInterval=Interval{micros::Int64,days::Int32,months::Int32}deriving(Show,Eq)maxDiffTime::DiffTime=1780000*Time.microsToDiffTimeTime.yearMicrosminDiffTime::DiffTime=negatemaxDiffTimefromDiffTime::DiffTime->MaybeIntervalfromDiffTimex=ifx>maxDiffTime||x<minDiffTimethenNothingelseJust$fromPicosUnsafe(unsafeCoercex)fromPicosUnsafe::Integer->IntervalfromPicosUnsafe=evalState$domodify$flipdiv(10^6)u<-state$swap.flipdivMod(10^6*60*60*24)d<-state$swap.flipdivMod(31)m<-getreturn$Interval(fromIntegralu)(fromIntegrald)(fromIntegralm)toDiffTime::Interval->DiffTimetoDiffTimex=picosecondsToDiffTime$(10^6)*(fromIntegral(microsx)+10^6*60*60*24*(fromIntegral(daysx+31*monthsx)))
[8]ページ先頭