{-# LANGUAGE RecordWildCards #-}-- | Compatibility with the-- <old-time http://hackage.haskell.org/package/old-time> package for the-- \"new\" <time http://hackage.haskell.org/package/time> package.---- This is useful for writing portable code; in particular, if you're-- using the <directory http://hackage.haskell.org/package/directory>-- package and you want your code to build with both GHC 7.6 and earlier-- versions. The version of @directory@ used with GHC 7.6 changed-- a dependency from @old-time@ to @time@ which means its-- @getModificationTime@ function now returns a 'Time.UTCTime' instead of-- a 'OldTime.ClockTime'. This type affects the public API of many-- libraries that use it. To make such libraries portable, port your-- code to use the @time@ package and to only rely on 'Time.UTCTime' in-- its public API, and call 'toUTCTime' on the values returned by-- functions like @getModificationTime@, for example:---- >fmap toUTCTime getModificationTime---- If you're using @directory-1.2@, 'toUTCTime' will just be 'id' and the-- original value is returned intact. If you're using an older-- @directory@, for example because you're building with GHC 7.4, the-- 'OldTime.ClockTime' returned by @getModificationTime@ will be-- converted to a 'Time.UTCTime' and will be compatible with your code-- ported to the new @time@ package.moduleData.Time.Compat(-- * Converting between representationsToUTCTime(..))whereimportqualifiedData.TimeasTimeimportqualifiedSystem.TimeasOldTimeclassToUTCTimeawheretoUTCTime::a->Time.UTCTimeinstanceToUTCTimeTime.UTCTimewheretoUTCTime=idinstanceToUTCTimeOldTime.ClockTimewheretoUTCTime=toUTCTime.OldTime.toUTCTimeinstanceToUTCTimeOldTime.CalendarTimewheretoUTCTimeOldTime.CalendarTime{..}=Time.UTCTimedaydiffTimewhereyear=fromIntegralctYearmonth=fromEnumctMonthday=Time.fromGregorianyearmonthctDaysec=ctHour*60^2+ctMin*60+ctSecpico=fromIntegralsec*10^12+ctPicosecdiffTime=Time.picosecondsToDiffTimepico