Distribution.Compat.Time

Cabal-3.2.0.0: A framework for packaging Haskell software

Safe Haskell | None
Language | Haskell2010

Distribution.Compat.Time

Synopsis

- newtype ModTime = ModTime Word64
- getModTime :: FilePath -> NoCallStackIO ModTime
- getFileAge :: FilePath -> NoCallStackIO Double
- getCurTime :: NoCallStackIO ModTime
- posixSecondsToModTime :: Int64 -> ModTime
- calibrateMtimeChangeDelay :: IO (Int, Int)

# Documentation

newtype ModTime Source #

An opaque type representing a file's modification time, represented internally as a 64-bit unsigned integer in the Windows UTC format.

Constructors

ModTime Word64 |

#### Instances

Instances details

Bounded ModTime # |
Instance details Defined in Distribution.Compat.Time Methods minBound :: ModTime Source # maxBound :: ModTime Source #
Eq ModTime # |
Instance details Defined in Distribution.Compat.Time Methods (==) :: ModTime -> ModTime -> Bool # (/=) :: ModTime -> ModTime -> Bool #
Ord ModTime # |
Instance details Defined in Distribution.Compat.Time Methods compare :: ModTime -> ModTime -> Ordering # (<) :: ModTime -> ModTime -> Bool # (<=) :: ModTime -> ModTime -> Bool # (>) :: ModTime -> ModTime -> Bool # (>=) :: ModTime -> ModTime -> Bool # max :: ModTime -> ModTime -> ModTime # min :: ModTime -> ModTime -> ModTime #
Read ModTime # |
Instance details Defined in Distribution.Compat.Time Methods readsPrec :: Int -> ReadS ModTime Source # readList :: ReadS [ModTime] Source # readPrec :: ReadPrec ModTime Source # readListPrec :: ReadPrec [ModTime] Source #
Show ModTime # |
Instance details Defined in Distribution.Compat.Time Methods showsPrec :: Int -> ModTime -> ShowS Source # show :: ModTime -> String Source # showList :: [ModTime] -> ShowS Source #
Generic ModTime # |
Instance details Defined in Distribution.Compat.Time Associated Types type Rep ModTime :: Type -> Type Source # Methods from :: ModTime -> Rep ModTime x Source # to :: Rep ModTime x -> ModTime Source #
Binary ModTime # |
Instance details Defined in Distribution.Compat.Time Methods put :: ModTime -> Put Source # get :: Get ModTime Source # putList :: [ModTime] -> Put Source #
Structured ModTime # |
Instance details Defined in Distribution.Compat.Time Methods structure :: Proxy ModTime -> Structure Source # structureHash' :: Tagged ModTime MD5
type Rep ModTime # |
Instance details Defined in Distribution.Compat.Time type Rep ModTime = D1 ('MetaData "ModTime" "Distribution.Compat.Time" "Cabal-3.2.0.0" 'True) (C1 ('MetaCons "ModTime" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64)))

getModTime :: FilePath -> NoCallStackIO ModTime Source #

Return modification time of the given file. Works around the low clock resolution problem that `getModificationTime` has on GHC < 7.8.

This is a modified version of the code originally written for Shake by Neil Mitchell. See module Development.Shake.FileInfo.

getFileAge :: FilePath -> NoCallStackIO Double Source #

Return age of given file in days.

getCurTime :: NoCallStackIO ModTime Source #

Return the current time as `ModTime`.

posixSecondsToModTime :: Int64 -> ModTime Source #

Convert POSIX seconds to ModTime.

calibrateMtimeChangeDelay :: IO (Int, Int) Source #

Based on code written by Neil Mitchell for Shake. See `sleepFileTimeCalibrate` in `Type`. Returns a pair of microsecond values: first, the maximum delay seen, and the recommended delay to use before testing for file modification change. The returned delay is never smaller than 10 ms, but never larger than 1 second.