Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Attempt at getting HANDLE for getAccessTime

  • Loading branch information...
commit 4654aec4d3142cd788f08fae4726c1b15ba4e8ad 1 parent 837d333
Max Bolingbroke authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 System/Directory/AccessTime.hs
4 System/Directory/AccessTime.hs
View
@@ -26,12 +26,14 @@ getAccessTimeResolution _ = return $ noTimeDiff { tdSec = 1 }
import Foreign.Ptr
+import Control.Exception (bracket)
+
import System.FilePath.Windows
import System.Win32.Time
import System.Win32.Types
-getAccessTime fp = do
+getAccessTime fp = bracket (createFile fp gENERIC_READ (fILE_SHARE_WRITE .|. fILE_SHARE_READ) Nothing oPEN_EXISTING fILE_ATTRIBUTE_NORMAL Nothing) closeHandle $ \h -> do
(_creation_time, access_time, _write_time) <- getFileTime h
fmap systemTimeToClockTime $ fileTimeToSystemTime access_time
Please sign in to comment.
Something went wrong with that request. Please try again.