diff --git a/lib/Data/Time/Clock/Internal/NominalDiffTime.hs b/lib/Data/Time/Clock/Internal/NominalDiffTime.hs index c919eab1dfb394cfe169b7890d6a0ff90ad7282e..70c3721ad1861271b0cd4844a306074b5aa454a5 100644 --- a/lib/Data/Time/Clock/Internal/NominalDiffTime.hs +++ b/lib/Data/Time/Clock/Internal/NominalDiffTime.hs @@ -16,9 +16,11 @@ import Control.DeepSeq -- | This is a length of time, as measured by UTC. +-- It has a precision of 10^-12 s. +-- -- Conversion functions will treat it as seconds. -- For example, @(0.010 :: NominalDiffTime)@ corresponds to 10 milliseconds. --- It has a precision of 10^-12 s. +-- -- It ignores leap-seconds, so it's not necessarily a fixed amount of clock time. -- For instance, 23:00 UTC + 2 hours of NominalDiffTime = 01:00 UTC (+ 1 day), -- regardless of whether a leap-second intervened. diff --git a/lib/Data/Time/Clock/POSIX.hs b/lib/Data/Time/Clock/POSIX.hs index f207c7374a759d0f6f7c8b0c89a8609f9459e35c..edd20241a0e4f87d5b93227faaab4b7af67eed1e 100644 --- a/lib/Data/Time/Clock/POSIX.hs +++ b/lib/Data/Time/Clock/POSIX.hs @@ -1,21 +1,20 @@ -- | POSIX time, if you need to deal with timestamps and the like. -- Most people won't need this module. -- --- If you want to convert POSIX time to integer/word timestamps, --- consider the following example: +-- You can use 'POSIXTime' to obtain integer/word timestamps. For example: -- --- > import Data.Time.Clock (UTCTime, getCurrentTime, nominalDiffTimeToSeconds) --- > import Data.Time.Clock.POSIX (utcTimeToPOSIXSeconds) --- > import Data.Int (Int64) +-- > import Data.Time +-- > import Data.Time.Clock.POSIX +-- > import Data.Int -- > -- > nanosSinceEpoch :: UTCTime -> Int64 -- > nanosSinceEpoch = --- > floor . (1e9 *) . nominalDiffTimeToSeconds . utcTimeToPOSIXSeconds +-- > floor . (1e9 *) . nominalDiffTimeToSeconds . utcTimeToPOSIXSeconds -- > -- > main :: IO () -- > main = do --- > u <- getCurrentTime :: IO UTCTime --- > print (nanosSinceEpoch u) +-- > u <- getCurrentTime +-- > print $ nanosSinceEpoch u module Data.Time.Clock.POSIX ( posixDayLength,POSIXTime,posixSecondsToUTCTime,utcTimeToPOSIXSeconds,getPOSIXTime,getCurrentTime,