Permalink
Browse files

Attempt at getting HANDLE for getAccessTime

  • Loading branch information...
1 parent 837d333 commit 4654aec4d3142cd788f08fae4726c1b15ba4e8ad @batterseapower committed Jan 28, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 System/Directory/AccessTime.hs
@@ -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

0 comments on commit 4654aec

Please sign in to comment.