[commit: packages/directory] master: Provide compatibility fallback for GHC 7.4.x (b706012)

git at git.haskell.org git at git.haskell.org
Sun Oct 13 16:05:35 UTC 2013


Repository : ssh://git@git.haskell.org/directory

On branch  : master
Link       : http://git.haskell.org/packages/directory.git/commitdiff/b706012522a74b9cc81efe55ac10c76ec862f4ea

>---------------------------------------------------------------

commit b706012522a74b9cc81efe55ac10c76ec862f4ea
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sun Oct 13 12:52:56 2013 +0200

    Provide compatibility fallback for GHC 7.4.x
    
    This also adds a documentation note w.r.t. `getModificationTime`
    requiring `unix>=2.6.0.0` for providing sub-second resolution (from
    which it can be inferred that on Windows support is missing for
    sub-second resolution right now)
    
    Signed-off-by: Herbert Valerio Riedel <hvr at gnu.org>


>---------------------------------------------------------------

b706012522a74b9cc81efe55ac10c76ec862f4ea
 System/Directory.hs |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/System/Directory.hs b/System/Directory.hs
index 0444d0e..9dabe1f 100644
--- a/System/Directory.hs
+++ b/System/Directory.hs
@@ -966,6 +966,10 @@ The operation may fail with:
 
 * 'isDoesNotExistError' if the file or directory does not exist.
 
+Note: When linked against @unix-2.6.0.0@ or later the reported time
+supports sub-second precision if provided by the underlying system
+call.
+
 -}
 
 getModificationTime :: FilePath -> IO UTCTime
@@ -977,7 +981,11 @@ getModificationTime name = do
 #else
   stat <- Posix.getFileStatus name
   let mod_time :: POSIXTime
+#if MIN_VERSION_unix(2,6,0)
       mod_time = Posix.modificationTimeHiRes stat
+#else
+      mod_time = realToFrac $ Posix.modificationTime stat
+#endif
   return $ posixSecondsToUTCTime mod_time
 #endif
 



More information about the ghc-commits mailing list