From 6a437d647584cbda65011775a38cf1e8e162d1e9 Mon Sep 17 00:00:00 2001 From: Ashley Yakeley <ashley@semantic.org> Date: Fri, 15 Mar 2019 01:08:44 -0700 Subject: [PATCH] Clean up documentation --- lib/Data/Time/Clock/Internal/NominalDiffTime.hs | 4 +++- lib/Data/Time/Clock/POSIX.hs | 15 +++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/Data/Time/Clock/Internal/NominalDiffTime.hs b/lib/Data/Time/Clock/Internal/NominalDiffTime.hs index c919eab..70c3721 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 f207c73..edd2024 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, -- GitLab