Can't truncate timestamp resolution with that version.
- License: BSD-2-clause
-}
+{-# LANGUAGE CPP #-}
+
module Utility.TimeStamp (
parserPOSIXTime,
parsePOSIXTime,
{- Truncate the resolution to the specified number of decimal places. -}
truncateResolution :: Int -> POSIXTime -> POSIXTime
+#if MIN_VERSION_time(1,9,1)
truncateResolution n t = secondsToNominalDiffTime $
fromIntegral ((truncate (nominalDiffTimeToSeconds t * d)) :: Integer) / d
where
d = 10 ^ n
+#else
+truncateResolution _ t = t
+#endif