[commit: directory] master: Make getModificationTime return a hi-resolution time; fixes #7473 (62aa6b1)
Ian Lynagh
igloo at earth.li
Wed Jan 2 18:55:35 CET 2013
Repository : ssh://darcs.haskell.org//srv/darcs/packages/directory
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/62aa6b14da8fe8d26fca162b3b93228f0333ebe3
>---------------------------------------------------------------
commit 62aa6b14da8fe8d26fca162b3b93228f0333ebe3
Author: Ian Lynagh <ian at well-typed.com>
Date: Wed Jan 2 15:28:54 2013 +0000
Make getModificationTime return a hi-resolution time; fixes #7473
We were only getting an integral number of seconds before. This change
only affects non-Windows platforms. Patch from Duncan Coutts.
>---------------------------------------------------------------
System/Directory.hs | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/System/Directory.hs b/System/Directory.hs
index 15c85e0..fe9c6f1 100644
--- a/System/Directory.hs
+++ b/System/Directory.hs
@@ -969,14 +969,14 @@ The operation may fail with:
getModificationTime :: FilePath -> IO UTCTime
getModificationTime name = do
#ifdef mingw32_HOST_OS
- -- ToDo: use Win32 API
+ -- ToDo: use Win32 API so we can get sub-second resolution
withFileStatus "getModificationTime" name $ \ st -> do
modificationTime st
#else
stat <- Posix.getFileStatus name
- let mod_time :: Posix.EpochTime
- mod_time = Posix.modificationTime stat
- return $ posixSecondsToUTCTime $ realToFrac mod_time
+ let mod_time :: POSIXTime
+ mod_time = Posix.modificationTimeHiRes stat
+ return $ posixSecondsToUTCTime mod_time
#endif
#endif /* __GLASGOW_HASKELL__ */
More information about the Cvs-libraries
mailing list